Add getUserInfo based on auth0-lock documentation on Github (#13823)

This commit is contained in:
Adrian Chia
2017-01-06 19:28:51 -06:00
committed by Andy
parent 8a27ebe4d2
commit 264995d8b9
2 changed files with 14 additions and 0 deletions

View File

@@ -26,6 +26,18 @@ lock.on("authenticated", function(authResult : any) {
});
});
lock.on("authenticated", function(authResult : any) {
lock.getUserInfo(authResult.accessToken, function(error, profile) {
if (error) {
// Handle error
return;
}
localStorage.setItem("idToken", authResult.idToken);
localStorage.setItem("profile", JSON.stringify(profile));
});
});
// test theme

View File

@@ -107,6 +107,8 @@ interface Auth0LockStatic {
new (clientId: string, domain: string, options?: Auth0LockConstructorOptions): Auth0LockStatic;
getProfile(token: string, callback: (error: Auth0Error, profile: Auth0UserProfile) => void) : void;
getUserInfo(token: string, callback: (error: Auth0Error, profile: Auth0UserProfile) => void) : void;
show(): void;
hide(): void;
logout(query: any): void;