admin管理员组文章数量:1332107
I am trying to make the new google one tap sign in work following this guide:
When I call :
const hintPromise = googleyolo.hint({
supportedAuthMethods: [
""
],
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: "",
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: "http://localhost:3000",
authMethod: "",
displayName: "testName",
id: "[email protected]"
}
Has anyone managed to get this to work?
I am trying to make the new google one tap sign in work following this guide:
https://developers.google./identity/one-tap/web/get-started
When I call :
const hintPromise = googleyolo.hint({
supportedAuthMethods: [
"https://accounts.google."
],
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.",
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: "http://localhost:3000",
authMethod: "https://accounts.google.",
displayName: "testName",
id: "[email protected]"
}
Has anyone managed to get this to work?
Share edited Oct 28, 2017 at 1:55 Steven 3,88024 silver badges39 bronze badges asked Oct 27, 2017 at 14:30 d--bd--b 5,7793 gold badges45 silver badges72 bronze badges 1- 1 Hmm, is the domain you're running the code on registered in the developer console for the client ID that you are using? (looks like you are try on localhost:3000 ?) If you send me your client ID, I can take a look -- [email protected] – Steven Commented Oct 28, 2017 at 1:01
2 Answers
Reset to default 9I had the same issue, but was able to resolve it by adding the correct "Authorized JavaScript origins" at https://console.developers.google./ 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."
We just published some troubleshooting guidance: https://developers.google./identity/one-tap/web/troubleshooting
The most important things to check are the following:
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
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
check that you are using a supported user-agent. Importantly, the iOS emulation modes in Chrome Dev Tools are out-of-date (fix pending)
If you still cannot get it working, or have any feedback at all, we'd love to hear from you: reach out to [email protected]
本文标签: javascriptGoogle one tap signin does not return idTokenStack Overflow
版权声明:本文标题:javascript - Google one tap sign-in does not return idToken - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742232235a2437430.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论