相关文章推荐
高大的高山  ·  python ...·  11 月前    · 
悲伤的拐杖  ·  Springboot2 ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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

Ask Question

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.

    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 same Andreas Oetjen Feb 16, 2017 at 9:12 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 months Poke Feb 16, 2017 at 16:13 For me the issue was wrong info in the GoogleService-Info.plist - looks like it used the web IDs instead of the iOS ones. Sea Coast of Tibet Mar 1, 2017 at 8:22

    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

    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. Poke Feb 16, 2017 at 19:04 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? Poke Feb 17, 2017 at 20:01 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. Poke Feb 21, 2017 at 20:29

    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

    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

    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

    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.

    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 type Vinoth Vino Apr 23, 2021 at 8:28 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. DaveDude Apr 1, 2017 at 14:43

    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:

  • Go to the Google Developers console.
  • Go to the Credentials section.
  • Notice there are two items in the "OAuth 2.0 client IDs" section. (If you previously attempted to configure an iOS Google SignIn project.
  • Click on the name of the "iOS client for ".
  • Click "Download PLIST File".
  • Delete the Google web Plist file from your project.
  • Drop in the new iOS based Plist file.
  • 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).
  • Attempt to run your app again.
  • Note: I got the Google Sign In API to work with Swift v3 and XCode v8.

    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.

    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,

    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

    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
  • Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question . Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers .