6

I am trying to implement google sign in using firebase in to my iOS app. I follow this tutorial. https://firebase.google.com/docs/auth/ios/google-signin I have setup the iOS app in firebase and use the google clientID and reversedClientID from the dowloaded GoogleService-Info.plist.

FYI: I have a custom sign-in button instead of the google sign in button. Anyway when i click the sign in button, google following error display in a webview.

enter image description here

I know my problem is the same as which described in this question.

Google 400 Error: invalid request Custom scheme URIs are not allowed for 'Web' client type

But, in my case, I have created the app in Firebase still I get the error. Any idea please...

Community
  • 1
  • 1
smartsanja
  • 4,413
  • 9
  • 58
  • 106

3 Answers3

14

The first step is to check if you have already the OAuth 2.0 ID for iOS. To do this please open the Credentials page in the API Console. I hope you will find iOS client for your application under OAuth 2.0 client IDs section. If not, please follow this Guide The second step is to replace the Web Client ID with in iOS Client ID from OAuth 2.0 client IDs section. To do this, you should open the GoogleService-Info.plist and modify following keys: CLIENT_ID with [value].apps.googleusercontent.com and REVERSED_CLIENT_ID with com.googleusercontent.apps.[value].

Valeriy Kliuk
  • 456
  • 1
  • 5
  • 9
  • Yes. I found ios app in Credentials page. But its very confusing because, in firebase I have created an ios app too. But firebase given a web client id. Google makes everything confusing – smartsanja Mar 30 '17 at 00:18
  • @sajaz I know, this is strange. Me too, I had the same experience with the GIDSignIn. – Valeriy Kliuk Mar 30 '17 at 00:44
  • Following this thread. I've also created my app from Firebase but it provides a WEB clientId? WTF? I have signed my app with an SHA for Android and created the iOS key as @ValeriyKliuk said. It works, but it generates different clientIds among platforms. Look this: http://stackoverflow.com/questions/42760596/ionic-ios-app-error-custom-scheme-uris-are-not-allowed-for-web-client-type/43366712#43366712 Thanks! – Carlos Zinato Apr 12 '17 at 10:19
0

if you're using flutterfire ui package you need to change the client id parameter in your GoogleProviderConfiguration class with the iOS client id, you can copy it from here Credential page

example:

providerConfigs: [
        GoogleProviderConfiguration(
            clientId: "your copied key here"),
]

re-build you're app and you should be good to go

0

I've just faced this same issue using flutterfire_ui on Flutter. The error appears to be from a couple of things. As Valeriy points out you need the ios client ID. But I still got the error if I used the scopes

openid
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/userinfo.profile",

Instead change these to

openid
email
profile

Strangely the opposite is true for Android, where the WebID and the first of the scopes should be used.

It also pays to be aware of the OAuth Content Screen.. In google cloud go to APIs & Services > OAuth consent screen > Edit. You can add scopes here and fix any missing required fields that Firebase might not be filling out (I had 1). I believe this takes a while to propagate after a change, so give it an hour.

MousyBusiness
  • 188
  • 2
  • 14