Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
ThbltLmr
left a comment
There was a problem hiding this comment.
One thing that's not super clear to me: who is meant to enforce roles and store users in the end? cause I see there are PRs on the API to add user endpoints? pyronear/pyro-api#657
| redirect_uri: appConfig.getConfig().KEYCLOAK_REDIRECT_URI, | ||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| onSigninCallback: (_user: User | undefined): void => { | ||
| // Permet de supprimer les éléments d'authent dans l'url (fausse react router) |
There was a problem hiding this comment.
little french comment snuck in ;)
There was a problem hiding this comment.
Nice point. I'll change it
| const { i18n } = useTranslation(); | ||
| return ( | ||
| <AuthProviderOidc {...oidcConfig(i18n.language)}> | ||
| <CustomAuthProvider>{children}</CustomAuthProvider> |
There was a problem hiding this comment.
I'm not familiar with react-oidc-context, but it's surprising that we still need our own child context nested in it 🤔
There was a problem hiding this comment.
I use it to hide the config of react oidc context, and provide a few transformed information
| if (user) { | ||
| accessToken = extractAccessToken(user); | ||
| } | ||
| return accessToken?.roles ?? []; |
There was a problem hiding this comment.
I'm not an expert, but I think when we had keycloak on a project, roles were not directly in user.access_token, they were nested? user.access_token.realm_access.roles I think?
There was a problem hiding this comment.
It depends how you configure your token in keycloak :)
Both should control the role : frontend, to prevent the user to access some functions and backend for security (if api is called directly) |
4ce8904 to
58d8cc8
Compare
58d8cc8 to
4b2459d
Compare
Uh oh!
There was an error while loading. Please reload this page.