0
我試圖在Web API應用程序來使用OAuth認證的承載,一切工作正常在我的本地IIS,我能夠獲得令牌,你可以在這裏看到:➤爲什麼OAuth承載認證在發佈到Azure中的API應用時無法在MVC Web API中工作?
但是,當我將我的項目發佈到Azure中的ApiApp,它根本不起作用。我得到的迴應:
{ 「消息」:「沒有HTTP資源發現匹配的請求URI‘https://mysite.azurewebsites.net/API/login’。」, 「messageDetail」:「沒有類型被發現,命名爲‘登錄’控制器匹配「。 }
如圖這裏:
我Startup.Auth類的樣子:
public partial class Startup
{
public static OAuthAuthorizationServerOptions OAuthOptions { get; private set; }
public static string PublicClientId { get; private set; }
// For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
public void ConfigureAuth(IAppBuilder app)
{
app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions());
// Configure the application for OAuth based flow
PublicClientId = "self";
OAuthOptions = new OAuthAuthorizationServerOptions
{
TokenEndpointPath = new PathString("/login"),
Provider = new ApplicationOAuthProvider(),
AuthorizeEndpointPath = new PathString("/api/Account/ExternalLogin"),
AccessTokenExpireTimeSpan = TimeSpan.FromDays(14),
// In production mode set AllowInsecureHttp = false
//#if DEBUG
AllowInsecureHttp = true
//#endif
};
// Enable the application to use bearer tokens to authenticate users
app.UseOAuthAuthorizationServer(OAuthOptions);
}
}
我希望你能告訴我什麼,我做錯了。