You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the Twitter provider for login, we receive a JWT token. However, the payload of this JWT token does not include a nonce by default. We would like the JWT token issued by Firebase to include a custom nonce that we provide. Currently, we cannot find a way to supply this nonce. Is there any method to achieve this?
Steps and code to reproduce issue
We want to provide our custom nonce in signInWithTwitter function.
import{initializeApp}from'firebase/app';import{getAuth,TwitterAuthProvider,signInWithPopup}from'firebase/auth';constfirebaseConfig={...firebaseConfig};constapp=initializeApp(firebaseConfig);constauth=getAuth(app);consttwitterProvider=newTwitterAuthProvider();exportconstsignInWithTwitter=()=>{// we want to provide custom nonce heresignInWithPopup(auth,twitterProvider).then((result)=>{constcredential=TwitterAuthProvider.credentialFromResult(result);console.log('credential',credential);consttoken=credential?.accessToken;constsecret=credential?.secret;// ...// The signed-in user info.constuser=result.user;console.log('token',token);console.log('secret',secret);console.log('user',user);console.log('credential',credential);}).catch((error)=>{consterrorCode=error.code;consterrorMessage=error.message;// The email of the user's account used.constemail=error.customData.email;// The AuthCredential type that was used.constcredential=TwitterAuthProvider.credentialFromError(error);console.log(errorCode,errorMessage,email,credential);});};
The text was updated successfully, but these errors were encountered:
I've marked this as a feature request here but I recommend that you also open a Firebase Support Ticket. This feature would require changes to the Firebase Service which is beyond the domain of those of us who support Firebase JS SDK. Instead, the Firebase Support team would be your best path forward for this issue. Thanks!
DellaBitta
changed the title
provide custom nonce
Auth: provide custom nonce on sign in
Dec 16, 2024
Operating System
macos
Environment (if applicable)
chrome 131.0.6778.86
Firebase SDK Version
11.0.2
Firebase SDK Product(s)
Auth
Project Tooling
react app with vite
Detailed Problem Description
When using the Twitter provider for login, we receive a JWT token. However, the payload of this JWT token does not include a
nonce
by default. We would like the JWT token issued by Firebase to include a customnonce
that we provide. Currently, we cannot find a way to supply thisnonce
. Is there any method to achieve this?Steps and code to reproduce issue
We want to provide our custom nonce in
signInWithTwitter
function.The text was updated successfully, but these errors were encountered: