64381

Google one tap sign-in does not return idToken

I am trying to make the new google one tap sign in work following this guide:

https://developers.google.com/identity/one-tap/web/get-started

When I call :

const hintPromise = googleyolo.hint({ supportedAuthMethods: [ "https://accounts.google.com" ], supportedIdTokenProviders: [ // Google can provide ID tokens -- signed assertions of a user's // identity -- which you can use to create more streamlined sign-in // and sign-up experiences. { uri: "https://accounts.google.com", clientId: "YOUR_GOOGLE_CLIENT_ID" } ] });

I get a response in the promise callback, with no error. But the idToken is empty...

hintPromise.then((credential) => { if (credential.idToken) { // <= THIS IS ALWAYS FALSE!!! // Send the token to your auth backend. loginWithGoogleIdToken(credential.idToken); } }, (error) => { console.log(error); });

the credential object looks like this:

{ authDomain: https://www.e-learn.cn/content/wangluowenzhang/"http://localhost:3000", authMethod: "https://accounts.google.com", displayName: "testName", id: "testEmail@gmail.com" }

Has anyone managed to get this to work?

Answer1:

I had the same issue, but was able to resolve it by adding the correct "Authorized JavaScript origins" at https://console.developers.google.com/ for my project. I needed to include the URI including the port "http://localhost:3000" rather than just "http://localhost".

From the google page - "If you're using a nonstandard port, you must include it in the origin URI."

Answer2:

We just published some troubleshooting guidance: https://developers.google.com/identity/one-tap/web/troubleshooting

The most important things to check are the following:

    <li>

    make sure that you supply a Google client ID in any requests and that the domain you are running the code is an authorized origin, including the port. See documentation for details

    </li> <li>

    ensure that you have an active Google Account and that the Smart Lock feature is enabled. Try with a regular gmail account with default settings

    </li> <li>

    check that you are using a supported user-agent. Importantly, the iOS emulation modes in Chrome Dev Tools are out-of-date (fix pending)

    </li> </ul>

    If you still cannot get it working, or have any feedback at all, we'd love to hear from you: reach out to sso@google.com

Recommend

  • Property 'catch' does not exist on type 'PromiseLike
  • Office365 authentication without login redirection
  • OAuth2 flow for mobile app
  • I have a modal that opens a second modal and cannot close the first modal if open then close the sec
  • New-PSSession in an Azure-runbook (ARM)
  • Why is my req.body always empty on POST?
  • Django: DRY principle and UserPassesTestMixin
  • IDX10503: Signature validation failed
  • oauth2client.client.HttpAccessTokenRefreshError: invalid_grant: Invalid JWT
  • Syntax error near unexpected token 'elif'
  • read values from form post in jquery or javascript
  • Django return user model id with L
  • How to use jQuery's $.post() method with async/await and typescript
  • Laravel: Getting Session ID oddly truncates when using foreach
  • Ionic 2 storage is not cleaning up on uninstall - Only for signed APK
  • Seeking advice on Jetty HttpClient Hang
  • Using variable in a value field in jMeter
  • Why is an OPTIONS request sent to the server?
  • C# - Is there a limit to the size of an httpWebRequest stream?
  • DotNetZip - Calculate final zip size before calling Save(stream)
  • How to add date and time under each post in guestbook in google app engine
  • How to redirect a user to a different server and include HTTP basic authentication credentials?
  • Updating server-side rendering client-side
  • How to pass list parameters for each object using Spring MVC?
  • Is there a mandatory requirement to switch app.yaml?
  • File upload with ng-file-upload throwing error
  • ExecuteAsync RestSharp to allow backgroundWorker CancellationPending c#
  • AngularJs get employee from factory
  • How to stop GridView from loading again when I press back button?
  • Bitwise OR returns boolean when one of operands is nil
  • sending mail using smtp is too slow
  • Easiest way to encapsulate a HTML5 webpage into an android app?
  • Busy indicator not showing up in wpf window [duplicate]
  • costura.fody for a dll that references another dll
  • Binding checkboxes to object values in AngularJs
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • java string with new operator and a literal