Hello team, Does supertokens support google's prompt login. Like login via google without redirectio...
m
Hello team, Does supertokens support google's prompt login. Like login via google without redirection. Where google shows you the login accounts directly on the site.
r
Hey @me_abhii
Tagging @sattvikc here. Who can help on Monday
m
Sure. Thanks @rp_st
s
hey @me_abhii , I can help you with this. Can you tell me which backend SDK (node, go, python) are you using?
m
I am using node
s
cool, I'll share the snippet in a while
Please try this:
r
@me_abhii see this please.
m
Thank you @sattvikc
s
hey @me_abhii I think I misunderstood your question. Did you mean showing google logged in users on the frontend page itself? using the google's js API ?
r
Yea.. thats what they meant @sattvikc
s
cool, will share the snippet in a while
on the backend
for the frontend, use this link to generate the frontend code - https://developers.google.com/identity/gsi/web/tools/configurator
onSignIn callback should be on these lines:
Copy code
ts
const onSignIn = async function(response: any) {
  try {
    const result = await axios.post('http://localhost:3001/auth/signinup', {
      thirdPartyId: "google",
      redirectURI: "http://localhost:3000",
      authCodeResponse: {
        access_token: 'use-id-token',
        id_token: response.credential,
      }
    })
    // Successful login ...
  } catch (err) {
    // handle error
  }
}
@me_abhii let me know if this helps