67

My flutter app uses Firebase Auth (Phone). I keep seeing the error: 'Please register custom URL scheme 'com.googleusercontent.apps.602546125958-5lk04ghhdfj5xxxxxxxx'.

I have added the URL schema to the info.plist as follows, but I'm getting the same error.

enter image description here

2020-04-29 20:40:05.173962-0400 Runner[395:20944] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Please register custom URL scheme 'com.googleusercontent.apps.602546125958-5lk04ghhdfj5xxxxxxxx' in the app's Info.plist file.'
*** First throw call stack:
(0x1889035f0 0x188625bcc 0x1887f9b28 0x10086cfa8 0x100f056a0 0x102efb3b0 0x102e921bc 0x102eeb9cc 0x102ea2a68 0x102ea4dcc 0x1888821c0 0x188881edc 0x1888815b8 0x18887c5c8 0x18887bc34 0x1929c538c 0x18c9ae22c 0x10082addc 0x188703800)
libc++abi.dylib: terminating with uncaught exception of type NSException
0

8 Answers 8

132

Delete you URL Type entry from .plist file and follow the steps, .plist entry will be automatically generated.

This works for Flutter as well

Steps:

enter image description here

You can click on + in URL Types if you want to add more than 1 URL Schemes.

Please comment if you have any questions.

Happy to help!

4
  • 4
    Thanks for the detailed and very lovely painted instruction! May 28, 2020 at 17:23
  • 10
    The instruction is also here: firebase.google.com/docs/auth/ios/… Jun 13, 2020 at 16:30
  • If this doesn't work right away, close XCODE and re-open. Jan 1, 2021 at 22:49
  • If you would like to support flavors with your URL entries, you should pass your flavor's/scheme's bundle identifier for different URL schemes.
    – shuster
    Jan 9, 2023 at 14:51
25

There is a Firebase documentation for iOS phone verification setup:

To enable the Firebase SDK to use reCAPTCHA verification:

Add custom URL schemes to your Xcode project:

  1. Open your project configuration: double-click the project name in the left tree view. Select your app from the TARGETS section, then select the Info tab, and expand the URL Types section.
  2. Click the + button, and add a URL scheme for your reversed client ID. To find this value, open the GoogleService-Info.plist configuration file, and look for the REVERSED_CLIENT_ID key. Copy the value of that key, and paste it into the URL Schemes box on the configuration page. Leave the other fields blank. When completed, your config should look something similar to the following (but with your application-specific values):

https://firebase.google.com/docs/auth/ios/phone-auth?authuser=0

Works for Flutter too.

14

I had the same problem. Try with the following setting.

enter image description here

2
  • This worked for me just now though I had to also delete and re-add my GoogleService-info.plist.
    – lost baby
    Sep 14, 2020 at 3:59
  • Yea , it's worked in my flutter project . thanks Jul 29, 2023 at 9:35
7

You need to register custom URL scheme in the app's Info.plist file.

Add this line in your info.plist

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleIdentifier</key>
        <string></string>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>enter your custom URL scheme here</string>
        </array>
    </dict>
</array>
6
In Flutter or Swift Project, 

You will get the REVERSED_CLIENT_ID in the GoogleService-info.plist file. 

<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.465370197171-9vgd73go8jnp3ae00cn29009u8fee5du</string>

You then need to add this value in your info.plist as follows:

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleIdentifier</key>
        <string></string>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string> VALUE OF REVERSED_CLIENT_ID</string>
        </array>
    </dict>
</array>
2

Add the reverse client id in the url launcher.

Reverse client id is located in googleservies.infolist xcode and copy the url and paste the url in url launcher by add the link

1
  • 1
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Feb 18, 2022 at 14:45
1

My issue was I had copied the GoogleService-info.plist into the wrong directory. There is a top level folder named after your app, and a folder with the same name, inside that one. So like, MyApp/MyApp, it needs to be inside that second, inner folder.

1

I encountered this same problem in 2024 as I was working on adding Flavors to my Flutter app.

Prereq: solving this problem depends on having a REVERSED_CLIENT_ID for your app provided by Firebase. This value is typically available in your GoogleService-Info.plist file. BUT! Apparently, as of April, 2023, these parameters are only created by Firebase when Google Authentication is enabled for your Firebase app. Check out CLIENT_ID, REVERSED_CLIENT_ID and ANDROID_CLIENT_ID missing from GoogleService-Info.plist with Firebase on IOS for more details.

So if you look at you GoogleService-Info.plist file (inside your ios project folder) and do NOT see CLIENT_ID and REVERSED_CLIENT_ID, chances are that you need to enable Google Authentication for your Firebase app and redownload the GoogleService-Info.plist file. The REVERSED_CLIENT_ID can be seen in the new GoogleService-Info.plist file as follows:

Example of GoogleService-Info.plist file with the all-important CLIENT_ID and REVERSED_CLIENT_ID

After you have you REVERSED_CLIENT_ID, you need to edit your Info.plist file to look like the following picture. (Note that I am using two values - one to support each of my Flutter app flavors. If you don't have multiple flutter app flavors, you'll just omit the second value in the 'URL Schemes' array.

Enter the REVERSED_CLIENT_ID into the URL Schemes in Info.plist

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.