Hi @jdgamble555, you are pretty close. Now you need to insert custom claims
in order to extract the email
which you have used in the auth query. Custom claims will be inserted at the time of minting new jwt token and you need to host a firebase function for that. Please refer to this series of videos for further clarification. Your firebase functon will be something like this:
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
exports.addAdminRole = functions.https.onCall((data, context) => {
return admin.auth().getUserByEmail(data.email).then(user=>{
return admin.auth().setCustomUserClaims(user.uid, {
"https://dgraph.io/jwt/claims":{
"email": data.email
}
});
}).then(() => {
return {
message: `Success! `
}
}).catch(err => {
return err
})
})
where "https://dgraph.io/jwt/claims"
is your Namespace.
Your token will look something like:
{
"https://dgraph.io/jwt/claims": {
"email": "youremail@something.com"
},
"iss": "https://securetoken.google.com/project-id",
"aud": "fir-project1-259e7",
"auth_time": 1606373016,
"user_id": "17GoxvuNBZW9a9JS.......",
"sub": "17GoxvuNBZW9a9JSvw.........",
"iat": 1606373017,
"exp": 1606376617,
. . . . .