简体   繁体   中英

Okta Sign-in widget check if user is authenticated

I am integrating the Sign-in widget into the music store example. Using the widget I can sign in, and after successfull authentication I am redirected to the landing page. (using the code from the example page http://developer.okta.com/docs/guides/okta_sign-in_widget.html#creating-an-html-file-with-the-widget-code

In the music store example, the Request.IsAuthenticated is true after login, but this isn't the case wen logging in using the widget. How can I check if a user is signed in after he's authenticated using the sign-in widget?

One way you can do it is to call getUserInfo() on the token

oktaSignIn.authClient.token.getUserInfo().then(function(user) {
       console.log(user);
          }).catch(function(e){
            console.log(e);
          });

You can also use the introspect endpoint to validate the token

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM