Closed AlexGisi closed 1 year ago
You are not missing anything in the code.
As I can see from the error, the permissions field is not included in the token, so turning on RBAC for the API should be an easy workaround.
But the issue is caused by breaking changes of Pydantic v2 which now requires a default for Optional[] types.
The breaking change as one can read is that the field is now required https://docs.pydantic.dev/2.0/migration/#required-optional-and-nullable-fields
For minimizing the impact, one can assign None to the permissions in the model:
class Auth0User(BaseModel):
id: str = Field(..., alias='sub')
permissions: Optional[List[str]] = None
email: Optional[str] = Field(None, alias=f'{auth0_rule_namespace}/email') # type: ignore [literal-required]
Did you experience any issue with just adding the None assignment. I've monkey-patched that myself and it seems to be working.
It was the only issue I found so far. Would be great if it could be fixed in your official repo.
Any progress on this? Or should I fork?
Fixed in 0.5.0
I tried the simple example without the scoping:
and authenticated a user. But when I tried to execute the /secure endpoint, it returns
and the console error
Am I missing a piece of syntax?