FirebaseExtended / custom-auth-samples

Samples showcasing how to sign in Firebase using additional Identity Providers
Apache License 2.0
323 stars 97 forks source link

additional claim #19

Closed yusef-ho closed 5 years ago

yusef-ho commented 5 years ago

Hello, while i was reading this article "Authenticate your Firebase users with LINE Login" There is additionalClaims in server.js, but i didn't see where we put this code? Thanks

samtstern commented 5 years ago

@yusef-ho that's a good catch! The custom claims should be the second argument.

function generateFirebaseToken(lineMid) {
  var firebaseUid = 'line:' + lineMid;
  var additionalClaims = {
    provider: 'LINE'
  };
  return firebase.auth().createCustomToken(firebaseUid, additionalClaims);
}

More information here: https://firebase.google.com/docs/auth/admin/create-custom-tokens#create_custom_tokens_using_the_firebase_admin_sdk

samtstern commented 5 years ago

cc @khanhlvg