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

13

41

When I am signing into Gmail in my iOS App, I am getting the below error (screenshot) and the sign-in fields do not appear. We are loading the sign-in screen in a WKWebView.

  • We are using a custom URI redirect but why is google throwing this error now. What are the alternatives to a custom URI?
  • Swift 2.3 project
  • Using OAuthSwift v0.6.0 cocoapod
  • This started quite recently only in the past week or so I believe something changed with Google's APIs.

I have read that google is deprecating webviews for OAuth and will block requests on April 20, 2017. As seen here in a Google Developers Blog: https://developers.googleblog.com/2016/08/modernizing-oauth-interactions-in-native-apps.html

Does this mean I already need to use or is there another viable solution? I thought I had more time before needing to update this.

enter image description here

Showcase answered 16/2, 2017 at 9:3 Comment(5)
Yes, you'll have to use the build-in web-browser. But this shouldn't be such a big change, since all this URL-Schema-dance remains the sameFloriaflorian
Thanks for your reply. I have tried using a built-in browser but I get the same error. It must be some problem with the custom URI scheme. I don't know why it is throwing an error about it, when it was working for the last 6 monthsShowcase
Possible duplicate of 403 Error - Thats an error. Error: disallowed_useragentGimlet
For me the issue was wrong info in the GoogleService-Info.plist - looks like it used the web IDs instead of the iOS ones.Wilona
Hi @SeaCoastofTibet How did you switch from web ID to your iOS one?Scripture
A
27

My guess is that your client is registered incorrectly in Google Cloud Console. A 'WEB' client is typically a server or Javascript application. An iOS app should be registered as an iOS client.

https://developers.google.com/identity/protocols/OAuth2InstalledApp#creatingcred

Allele answered 16/2, 2017 at 18:51 Comment(3)
Thanks for the response. I understand it should be registered as an iOS client. It is set as a web application in the google console but it was working up until now in a webview. Not sure why it would suddenly error out.Showcase
This did work but now I need to send my auth credentials to a web appliction type server. Does anyone know of any cross-platform tokens I could use to do this?Showcase
You can solve this issue by switching to an iOS client type in the google console. In my case I solved this issue by creating my own redirect url on aws instead of using the redirect uri that was causing the issue.Showcase
S
20

I Just found this problem too.
Please check google developer console and look at the credentials keys
Your Client ID in google-info plist must come from iOS application, not the web.
And use that Client ID to be revereseClientID and copy it in to URI type

Surrejoinder answered 28/2, 2017 at 5:5 Comment(0)
M
3

I have solved the problems by create project in Fire Base Because REVERSED_CLIENT_ID generate from developers.google.com Incorrect. Try create your project in FireBase https://console.firebase.google.com

Marciano answered 6/3, 2017 at 3:31 Comment(1)
Apparently firebase-created projects also give WEB clientID for iOS =/Bolte
P
3

you must cross check clientId at your 'Google Dashboard' clientId and clientId at "GoogleProject.Plsit".if both are different, copy ClientID from 'Google Dashboard' and paste it on "GoogleService-Info.Plsit".and also amend your reverseClientId in "GoogleService-Info.Plsit" according to newly pasted ClientID(you check the pattern how reverseClientId created from client Id in "GoogleService-Info.Plsit"). And then paste thid reverseClientId in 'URL type' in your project setting.

In case of mine clientId on "GoogleService-Info.Plsit" and my 'Google Dashboard' were different. chech your google dashboard here : https://console.developers.google.com/apis/credentials?project=firebase

Presumption answered 10/3, 2017 at 6:9 Comment(0)
L
2

I just experienced this issue following the Google Signin for iOS Guide. The plist generated file is not the good one. You need to take a look at the clientID and reversedClientID and be sure that they are the ones for the iOS app on your Google developer portal.

Lawrence answered 5/3, 2017 at 21:4 Comment(0)
C
1

I faced this error after previously creating a GoogleService-Info.plist file using the site Google Sign In directs you to. I later started using Firebase, which seems to create a separate .plist file. After attempting to include Firebase's new .plist file, my Google Sign In button started yielding the invalid_request error with the Custom scheme URIs are not allowed for WEB client type message.

In order to fix the problem I tried many things, but in the end deleting MY ENTIRE Firebase project on their web console (not just the individual app), recreating a new Firebase project from scratch, and re-downloading the new .plist file, solved the error.

Clench answered 10/3, 2017 at 22:3 Comment(2)
I created a new project. Still facing the same issue. Did you find a root cause?Fourposter
Even I created a new firebase project but facing the same issue, I'm getting a different reversed client id in the exception. If I use that then I'll get an exception "Custom schemes URL are not allowed for web client typeTaddeusz
H
1

It creates two client ID. one for web and one for iOS application. Web client will be in the google plist by default. So it gives the above error. Use iOS Client id from google console or create credential for iOS application.

Hatpin answered 16/3, 2017 at 3:49 Comment(1)
This happened to me also. I have a project with several targets. For whatever reason the first target I used worked correctly, and the generated .plist file used the iOS client. When I went to a different target, I got the Web Client id downloaded. After switching my plist content, things worked. When I look at me two targets in the Google Console - on the one that worked, the iOS client id shows first in the display, and on the one that didn't, it shows second. Go figure.Eggert
N
1

For my experience, I had followed Google's SignIn iOS Swift guide and had downloaded a Web OAuth JSON file. They literally provide you the wrong Plist file for an iOS setup.

Just in case somebody else runs into this issue here are the steps I followed:

  1. Go to the Google Developers console.
  2. Go to the Credentials section.
  3. Notice there are two items in the "OAuth 2.0 client IDs" section. (If you previously attempted to configure an iOS Google SignIn project.
  4. Click on the name of the "iOS client for ".
  5. Click "Download PLIST File".
  6. Delete the Google web Plist file from your project.
  7. Drop in the new iOS based Plist file.
  8. Copy over the new REVERSED_CLIENT_ID into your URL Types of the Info page of your project. (This is detailed in Google's guide).
  9. Attempt to run your app again.

Note: I got the Google Sign In API to work with Swift v3 and XCode v8.

Nomination answered 10/6, 2017 at 14:34 Comment(0)
I
0

I was getting the same error. Then I figured out, that I did not provide my app Bundle Id to access the Google Sign In Service in my app. You do that from the page with the link:

https://developers.google.com/mobile/add?platform=ios&cntapi=signin&cnturl=https:%2F%2Fdevelopers.google.com%2Fidentity%2Fsign-in%2Fios%2Fsign-in%3Fconfigured%3Dtrue&cntlbl=Continue%20Adding%20Sign-In

1.Sign in with your Google Developer account.

2.Create you app name and copy the App bundle Id from your project from: Project and Target List> General> Bundle Identifier.

3.Choose your Country

4.Enable Google- Sign In.

Then perform the necessary steps to integrate Google Sign In in with your iOS App.

Imamate answered 25/2, 2017 at 7:8 Comment(0)
D
0

I was facing the same issue. I followed all the instructions to integrate my app several times, and played with the code to see if there was any hidden issue in the code. I downloaded and configured the sample app from google at github https://github.com/googlesamples/google-services and go the same issue, so it was not the code.

It seemed like there is something in my console configuration so I switched between different google console apps, and played changing the bundle IDs.

The only thing that managed to fix this issue was to use Firebase instead. I created an app in the firebase console, downloaded the new plist, and it worked.

Still not sure why this didn't work for me in the first place, this doesn't seem to be a common problem, but I hope this helps someone. cheers,

Dustcloth answered 26/2, 2017 at 8:41 Comment(0)
T
0

Kindly check console.developers.google.com/apis/credentials for your project and see whether there is already a client_id in OAuth 2.0 client IDs section , if so then copy that client id and replace it with you GoogleService-Info.plist file's CLIENT_ID and accordingly change REVERSED_CLIENT_ID (in reverse manner) now clean and build your app and test it will work

Tavel answered 12/4, 2017 at 8:43 Comment(0)
G
0

I was using Meteor with Cordova and Meteor's official google integration, which relies on cordova-plugin-googleplus.

I had to:

  • create both an iOS and a web Client ID
  • use the web Client ID on the settings / server / database as documented
  • but then use the reverse of the iOS web client as the REVERSED_CLIENT_ID for cordova-plugin-googleplus
Germinal answered 9/2, 2022 at 15:48 Comment(0)
N
0

Expo, authentication with Google.logInAsync from expo-google-app-auth

In my case I just used androidClientId instead of androidStandaloneAppClientId

Nolte answered 28/3, 2022 at 13:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.