[英]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
(使用示例页面中的代码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.在音乐商店示例中,登录后 Request.IsAuthenticated 为真,但使用小部件登录时情况并非如此。 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一种方法是在令牌上调用
getUserInfo()
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 您还可以使用自省端点来验证令牌
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.