2016-08-14 8 views
0

나는 웹 API 응용 프로그램에서 OAuth를 베어러 인증을 사용하도록 시도하고는, 모든 당신이 여기에서 볼 수있는 내가 토큰을 얻을 수있어, 내 로컬 IIS에 잘 작동 Azure에서 내 프로젝트를 ApiApp에 게시하면 전혀 작동하지 않습니다.¿ Azure에서 API App에 게시 할 때 OAuth bearer auth가 MVC 웹 API에서 작동하지 않는 이유는 무엇입니까?</p> <p><a href="https://i.stack.imgur.com/Rf29E.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Rf29E.png" alt="enter image description here"></a></p> <p>그러나 때

{ "메시지": "어떤 HTTP 리소스를 찾을 수 없었다 요청 URI 'https://mysite.azurewebsites.net/API/login'과 일치합니다." "messageDetail를"나는 응답을 "어떤 종류의 '로그인'라는 이름의 컨트롤러를 일치를 찾을 수 없습니다 . " }

여기에 나타낸 바와 같이 : 난 당신이 내가 잘못는지 말해 수 있기를 바랍니다

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); 
    } 
} 

: 같은

enter image description here

내 Startup.Auth 클래스 보인다.

답변

0

나는 잘못된 URL을 사용하고있는 것으로 나타났습니다. 나는 단지/login 대신에/api/login을 사용했다.