diff --git a/auth0-lock/auth0.lock-tests.ts b/auth0-lock/auth0.lock-tests.ts index bba2fc8228..cd51950c6a 100644 --- a/auth0-lock/auth0.lock-tests.ts +++ b/auth0-lock/auth0.lock-tests.ts @@ -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 diff --git a/auth0-lock/index.d.ts b/auth0-lock/index.d.ts index 1a05d3f913..e2964d287c 100644 --- a/auth0-lock/index.d.ts +++ b/auth0-lock/index.d.ts @@ -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;