DEV Community

Cover image for A month of Flutter: configure Firebase Auth for Sign in with Google on iOS
Abraham Williams
Abraham Williams

Posted on • Originally published at bendyworks.com

A month of Flutter: configure Firebase Auth for Sign in with Google on iOS

Originally published on bendyworks.com.

Yesterday I configured Sign in with Google on Android. Today is more of the same but in iOS land.

From the app directory I ran open ios/Runner.xcworkspace to open the iOS project in Xcode. Then in Xcode I selected "Runner" under "Project navigator" in the left sidebar followed by "Runner" under "Targets" in the main content area. Here I set "Bundle identifier" to app.birb.

update Bundle identifier in Xcode

Using the development Firebase project from yesterday, I added a new iOS app using the same bundle ID.

add iOS app to Firebase project

Firebase then prompted me to download a GoogleService-Info.plist file.

download iOS config file

Once downloaded, I dragged the plist file into the Xcode "project navigation" sidebar within the "Runner" directory next to Info.plist. By dragging it into Xcode, it gets registered for inclusion during builds. There isn't any sensitive information in the file but for an open source project it will need to be different for every developer so I'm adding it to .gitignore.

drag plist into Xcode

I then skipped step three "add Firebase SDK" and step four "add initialization code".

There is one important change to ios/Runner/Info.plist: configuring a CFBundleURLSchemes. The value can be copied from the GoogleServiceInfo.plist file. I would like to not hard code this but I currently don't have a better alternative.

<array>
  <dict>
    <key>CFBundleTypeRole</key>
    <string>Editor</string>
    <key>CFBundleURLSchemes</key>
    <array>
      <!-- Copied from GoogleServices-Info.plist key REVERSED_CLIENT_ID -->
      <string>com.googleusercontent.apps.483795507272-cavro2su6d78ldumt6003lo2krdrb2dd</string>
    </array>
  </dict>
</array>
~~~

Starting the app should give Firebase the all set signal.

![adding Android app to Firebase project](https://thepracticaldev.s3.amazonaws.com/i/c04mqs2kzgcm3026bp3k.png)

And the Sign in with Google button still doesn't do anything but maybe tomorrow it really will.

## Code changes

- [#47 Configure Firebase Auth iOS](https://github.com/abraham/birb/pull/47)
Enter fullscreen mode Exit fullscreen mode

Top comments (3)

Collapse
 
himanshu1986r profile image
Himanshu1986R • Edited

Hi , I am using stable version of flutter and firebase_auth 0.8.1+1 version but it give me error again and again.....
flutter: PlatformException(ERROR_INTERNAL_ERROR, An internal error has occurred, print and inspect the error details for more information., null)
please help me to solve me this problem .
Thanks in advance…..

192.168.1.3:59264<->172.217.163.106:443 socket-flow] flow:start_connect
[ ] [DEVICE LOG] 2019-02-19 12:23:04.033074+0530 localhost
Runner[92855]: (Flutter) flutter: PlatformException(ERROR_INTERNAL_ERROR,
An internal error has occurred, print and inspect the error details for
more information., null)
[ ] [DEVICE LOG] 2019-02-19 12:23:04.033246+0530 localhost
Runner[92855]: (libnetwork.dylib) [com.apple.network:] 0.098s [C5.1
58D6A57D-7688-4128-827B-B9F1402FF220
192.168.1.3:59264<->172.217.163.106:443 socket-flow] flow:finish_transport
[ +1 ms] [DEVICE LOG] 2019-02-19 12:23:04.034802+0530 localhost
Runner[92855]: (libnetwork.dylib) [com.apple.network:] 0.098s [C5
F0796D79-46A3-415F-9087-A3A83AFA93CD googleapis.com:443 resolver]
flow:finish_transport
[ ] [DEVICE LOG] 2019-02-19 12:23:04.035563+0530 localhost
Runner[92855]: (libnetwork.dylib) [com.apple.network:] 0.274s [C5.1
58D6A57D-7688-4128-827B-B9F1402FF220
192.168.1.3:59264<->172.217.163.106:443 socket-flow] flow:finish_connect
[ ] [DEVICE LOG] 2019-02-19 12:23:04.035632+0530 localhost
Runner[92855]: (libnetwork.dylib) [com.apple.network:] 0.275s [C5
F0796D79-46A3-415F-9087-A3A83AFA93CD googleapis.com:443 resolver]
flow:finish_connect
[ ] [DEVICE LOG] 2019-02-19 12:23:04.035695+0530 localhost
Runner[92855]: (libnetwork.dylib) [com.apple.network:] 0.275s [C5.1
58D6A57D-7688-4128-827B-B9F1402FF220
192.168.1.3:59264<->172.217.163.106:443 socket-flow] flow:changed_viability
[ ] [DEVICE LOG] 2019-02-19 12:23:04.036785+0530 localhost
Runner[92855]: (libnetwork.dylib) [com.apple.network:] 0.276s [C5
F0796D79-46A3-415F-9087-A3A83AFA93CD googleapis.com:443 resolver]
flow:changed_viability
[ ] [DEVICE LOG] 2019-02-19 12:23:04.036846+0530 localhost
Runner[92855]: (libnetwork.dylib) [com.apple.network:] 0.633s [C5]
path:cancel
[ ] [DEVICE LOG] 2019-02-19 12:23:04.038871+0530 localhost
Runner[92855]: (libnetwork.dylib) [com.apple.network:]
nw_endpoint_flow_protocol_disconnected [C5.1 172.217.163.106:443 cancelled
socket-flow (null)] Output protocol disconnected
[ ] flutter: PlatformException(ERROR_INTERNAL_ERROR, An internal
error has occurred, print and inspect the error details for more
information., null)
[ ] [DEVICE LOG] 2019-02-19 12:23:04.043771+0530 localhost
Runner[92855]: (libnetwork.dylib) [com.apple.network:]
nw_connection_report_state_with_handler_locked [C5] reporting state
cancelled
[ ] [DEVICE LOG] 2019-02-19 12:23:04.044475+0530 localhost
Runner[92855]: (CFNetwork) TIC TCP Conn Destroyed [5:0x6000034d58c0]
[ ] [DEVICE LOG] 2019-02-19 12:23:04.044558+0530 localhost
Runner[92855]: (libboringssl.dylib) [com.apple.network.boringssl:BoringSSL]
nw_protocol_boringssl_get_output_frames(1301) [C5.1:2][0x7fce69721ff0] get
output frames failed, state 8196
[ ] [DEVICE LOG] 2019-02-19 12:23:04.044636+0530 localhost
Runner[92855]: (libboringssl.dylib) [com.apple.network.boringssl:BoringSSL]
nw_protocol_boringssl_get_output_frames(1301) [C5.1:2][0x7fce69721ff0] get
output frames failed, state 8196
[ ] [DEVICE LOG] 2019-02-19 12:23:04.044965+0530 localhost
Runner[92855]: (CFNetwork) TIC Read Status [5:0x0]: 1:57
[ ] [DEVICE LOG] 2019-02-19 12:23:04.045034+0530 localhost
Runner[92855]: (CFNetwork) TIC Read Status [5:0x0]: 1:57

Collapse
 
abraham profile image
Abraham Williams

ERROR_INTERNAL_ERROR makes it sounds to me like a server error of some sort. Maybe try again later or from a different network connection.

Collapse
 
himanshu1986r profile image
Himanshu1986R

thanks for reply ....
but its show same problem

[C2.1 1B2811E7-E8BF-43FB-BB7E-06DC07A1E996 192.168.1.3:50495<->216.58.196.202:443]
Connected Path: satisfied (Path is satisfied), interface: en0
Duration: 0.648s, DNS @0.002s took 0.025s, TCP @0.034s took 0.010s, TLS took 0.145s
bytes in/out: 5121/977, packets in/out: 10/9, rtt: 0.008s, retransmitted packets: 0, out-of-order packets: 0
flutter: PlatformException(ERROR_INTERNAL_ERROR, An internal error has occurred, print and inspect the error details for more information., null)