Getting Authorization has been denied for this request on Azure but works locally

I have been working with Auth0 on my Web API and ASP .NET MVC. Recently I decided to upload my Web API and MVC application to Azure. However, The Web API keeps replying “Authorization has been denied for this request” but it works fine when it runs in visual studio. Tested with postman and fiddler.


UPDATE:

I am using asp.net web api (owin), this is my configuration in the startup.cs:

public void Configuration(IAppBuilder app)
    {
        var domain = $"https://{ConfigurationManager.AppSettings"Auth0Domain"]}/";
        var apiIdentifier = ConfigurationManager.AppSettings"Auth0ApiIdentifier"];

        var keyResolver = new OpenIdConnectSigningKeyResolver(domain);
        app.UseJwtBearerAuthentication(
            new JwtBearerAuthenticationOptions
            {
                AuthenticationMode = AuthenticationMode.Active,
                TokenValidationParameters = new TokenValidationParameters()
                {
                    ValidAudience = apiIdentifier,
                    ValidIssuer = domain,
                    IssuerSigningKeyResolver = (token, securityToken, identifier, parameters) => keyResolver.GetSigningKey(identifier)
                }
            });

        // Configure Web API            
        WebApiConfig.Configure(app);
    }

The information provided is insufficient to troubleshoot the situation (unless someone else already experienced the exact same thing). The recommendation would be for you to update your question with additional information. For example, how the Web API is configured in terms of authorizing the request, any additional data about the error (stacktraces), a sample access token (assuming JWT be sure to not include the signature and if you deem any information within it sensitive also please redact it).

In case someone else have this problem the solution is here: base.IsAuthroized is false, but not when debugged locally · Issue #283 · IdentityServer/IdentityServer3.Samples · GitHub

Glad you found the culprit; it was a really subtle issue based on that issue.