小编Ama*_*dra的帖子

当MVC和Web API在不同的项目中时,如何存储持有者令牌

情况: 我有一个Web API 2项目,它充当授权服务器(/ token endpoint)和资源服务器.我正在使用ASP.Net Web API开箱即用的模板减去任何MVC参考.Start.Auth配置如下:

public void ConfigureAuth(IAppBuilder app)
        {
            // Configure the db context and user manager to use a single instance per request
            app.CreatePerOwinContext(ApplicationDbContext.Create);
            app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);

            // Enable the application to use a cookie to store information for the signed in user
            // and to use a cookie to temporarily store information about a user logging in with a third party login provider
            app.UseCookieAuthentication(new CookieAuthenticationOptions());
            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

            // Configure the application for OAuth based flow
            PublicClientId = …
Run Code Online (Sandbox Code Playgroud)

cookies asp.net-mvc oauth-2.0 asp.net-web-api bearer-token

10
推荐指数
1
解决办法
1万
查看次数