Hi Fellow Knacksters,
I’m working with a Next-Gen application where users log in via the configured Google SSO integration.
Goal:
After a successful Google SSO login, I need to obtain the user’s Google ID Token within my client-side JavaScript. This token is required to securely authenticate requests from the user’s browser to a private, external API
What I’ve Tried:
I’ve been exploring the Knack object in the browser’s developer console after a user logs in via Google SSO:
-
Inspecting
KnackObject: Usingconsole.dir(Knack), I looked through the available properties (user,auth,session, etc.) but couldn’t locate a property that clearly holds the Google ID Token. -
Using
Knack.getUser(): I calledawait Knack.getUser(). This function successfully returns an object with user details (ID, email, name) and atokenproperty. However, upon inspecting this token (it’s a JWT starting witheyJhbGciOiJIUzI1Ni...), it appears to be a Knack-specific session token, not the Google ID Token required for authenticating with Google Cloud services.
My Question:
Is there a documented or known method within the Next-Gen JavaScript environment to access the Google ID Token for the currently authenticated user after they have logged in using the Google SSO feature?
Specifically, how can my client-side code retrieve this token to be used in an Authorization: Bearer <ID_Token> header for calling an external Google-authenticated API?
Any pointers, examples, or insights would be greatly appreciated!
Thanks,
Gui
Fine Mountain Consulting