Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong access token required claims #137

Closed
stapetro opened this issue Jun 23, 2023 · 2 comments · Fixed by #138
Closed

Wrong access token required claims #137

stapetro opened this issue Jun 23, 2023 · 2 comments · Fixed by #138
Labels
question Further information is requested

Comments

@stapetro
Copy link

Describe the bug
I updated from 4.0.0 to 4.1.1 version and hit an issue regarding the following token claims - aio, uti, rh. They are required in fastapi_azure_auth.user.Claims class but according to Azure AD doc they are optional.

To Reproduce
Here's an example jwt token body from my infrastructure:

{
  "tid": "**dummy-tid**",
  "name": "Stanislav Petrov",
  "idp": "https://login.microsoftonline.com/***/v2.0",
  "sub": "**dummy-sub**",
  "oid": "**dummy-sub**",
  "tfp": "***",
  "nonce": "***",
  "scp": "**dummy-scp**",
  "azp": "**dummy-azp**",
  "ver": "1.0",
  "iat": 1687507633,
  "aud": "**dummy-aud**",
  "exp": 1687511233,
  "iss": "https://***.b2clogin.com/***/v2.0/",
  "nbf": 1687507633
}
  1. Instantiate fastapi_azure_auth.user.User class with the example token body above.

Stack trace

Unable to process jwt token. Uncaught error: 3 validation errors for User
aio
  field required (type=value_error.missing)
uti
  field required (type=value_error.missing)
rh
  field required (type=value_error.missing)
Traceback (most recent call last):
  File "C:\***\Lib\site-packages\fastapi_azure_auth\auth.py", line 208, in __call__
    user: User = User(
                 ^^^^^
  File "pydantic\main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 3 validation errors for User
aio
  field required (type=value_error.missing)
uti
  field required (type=value_error.missing)
rh
  field required (type=value_error.missing)

Your configuration
I'm in the single tenant case (fastapi_azure_auth.auth.SingleTenantAzureAuthorizationCodeBearer).

@stapetro stapetro added the question Further information is requested label Jun 23, 2023
@JonasKs
Copy link
Member

JonasKs commented Jun 23, 2023

Thank you! Pull request welcome.

@JonasKs
Copy link
Member

JonasKs commented Jun 23, 2023

New release out. Thanks for the bug report 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants