Ich versuche OAuth Inhaber Authentifizierung in einer Web-API-Anwendung zu verwenden, funktioniert alles auf meinem lokalen IIS in Ordnung, ich bin in der Lage das Token zu erhalten, wie Sie hier sehen können:¿Warum funktioniert die OAuth-Bearer-Authentifizierung nicht in einer MVC-Web-API, wenn sie in Azure in einer API-Anwendung veröffentlicht wird?
Aber wenn Ich veröffentliche mein Projekt auf einer ApiApp in Azure, es funktioniert überhaupt nicht. Ich erhalte die Antwort:
{ „message“: „Nein HTTP-Ressource gefunden wurde, dass die Anforderung URI‚https://mysite.azurewebsites.net/API/login‘übereinstimmt.“, „messageDetail“: „Kein Typ wurde gefunden, dass der Controller paßt den Namen‚login‘ . "
Klasse sieht My Startup.Auth wie: }
Wie hier gezeigt
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);
}
}
Ich hoffe, dass Sie mir sagen, was ich falsch mache.