简体   繁体   中英

unable to get the output from /token in web API

I am trying to generate the Token from the Owin. Below is the code of the Startup.cs

public void Configuration(IAppBuilder appBuilder)
{
        HttpConfiguration configuration = new HttpConfiguration();
        WebApiConfig.Register(configuration);
        appBuilder.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
        appBuilder.UseWebApi(configuration);
    }
    public void ConfigureOAuth(IAppBuilder appBuilder)
    {
        OAuthAuthorizationServerOptions OAuthServerOptions = new OAuthAuthorizationServerOptions()
        {
            AllowInsecureHttp = true,
            TokenEndpointPath = new PathString("/token"),
            AccessTokenExpireTimeSpan = TimeSpan.FromDays(1),
            Provider = new SimpleAuthorizationServerProvider()
        };
        appBuilder.UseOAuthAuthorizationServer(OAuthServerOptions);
        appBuilder.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions());    
    }

When i am trying to generate the Token using the PostMan below is teh error what I am recieving. Please let me know what is the issue over here.

在此处输入图片说明

抱歉。发生代码错误,我忘记在Configuration(IAppBuilder appBuilder)中调用我的ConfigureOAuth(IAppBuilder appBuilder)方法

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