Created
December 9, 2017 22:27
-
-
Save hiranya911/2fef4d522f4863366c967e8c1ce1bf28 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
firebase.auth().currentUser.getIdToken() | |
.then((idToken) => { | |
// Parse the ID token. | |
const payload = JSON.parse(b64DecodeUnicode(idToken.split('.')[1])); | |
var role = payload['role']; | |
if (role == 'moderator') { | |
showModeratorUI(); | |
} else { | |
showArticleFeed(); | |
} | |
}) | |
.catch((error) => { | |
console.log(error); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment