简体   繁体   中英

ASP.NET MVC and WebAPI shared token

I have ASP.NET MVC and Angular2 application and I'm using Identity Server 3. Typical workflow for user is to log on MVC application which stores obtained token in a cookie. After successful login, user can use angular2 application for specific operations and it resides on subdomain. Angular application "talks" to web api. Is it possible to share access token stored in a cookie between mvc and angular (javascript) client. Currently, I'm extracting access token and store it in local storage for using in ng2. It is working, but in my opinion this is not elegant solution

You can implement Direct Authentication in Angular and use SSO.

User will be logged in to ASP.NET MVC, the Angular will hit the identityserver and will returns the token.

You can use the OIDC.JS library to implement implicit flow in Angular.

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