jasontaylordev / CleanArchitecture

Clean Architecture Solution Template for ASP.NET Core
MIT License
16.78k stars 3.6k forks source link

[Azure] invalid_token - issuer is invalid #93

Closed psztypa closed 4 years ago

psztypa commented 4 years ago

Application works perfectly using localhost.

After deploying to Azure when trying to get ToDo list I get 401 Bearer error="invalid_token", error_description="The issuer 'https://....azurewebsites.net' is invalid"

I can register and sign-in users. Fetching data from WeatherForecast controller works just fine. So I think that app service and db are configured correctly.

Steps to reproduce the behaviour:

  1. Deploy to Azure
  2. Click on Todo
  3. See browsers dev tools
  4. 401 in network tab

My token after decoding (replaced app name with dots):

Header
{
  "alg": "RS256",
  "kid": "Development",
  "typ": "at+jwt"
}
Payload:
{
  "nbf": 1585162553,
  "exp": 1585166153,
  "iss": "https://...azurewebsites.net",
  "aud": "....WebUIAPI",
  "client_id": "...WebUI",
  "sub": "0a909b00-1cbe-4db5-ba85-c04ba056e06b",
  "auth_time": 1585159834,
  "idp": "local",
  "scope": [
    "openid",
    "profile",
    "....WebUIAPI"
  ],
  "amr": [
    "pwd"
  ]
}

Issuer is the same as application address.

Any suggestions are welcome :) Thank you in advance.

jasontaylordev commented 4 years ago

Hi @psztypa - check out my guide here - https://github.com/jasontaylordev/CleanArchitecture/issues/80#issuecomment-605941356.

Does this help? Did you figure this issue out?

jasontaylordev commented 4 years ago

Closing, but feel free to provide feedback at any point.