AxaFrance / oidc-client

Light, Secure, Pure Javascript OIDC (Open ID Connect) Client. We provide also a REACT wrapper (compatible NextJS, etc.).
MIT License
570 stars 152 forks source link

Where to check and create user on resource server with AXA OIDC React library? #1383

Open uhexos opened 3 weeks ago

uhexos commented 3 weeks ago

Issue and Steps to Reproduce

Description: I'm using the AXA OIDC React library for authentication in my application, and I need to implement functionality to check if the authenticated user exists on my resource server (API). If the user does not exist, I need to create a new user record on the resource server.

I'm not sure at which point in the authentication flow or which part of the library I should be implementing this functionality. Can someone point me in the right direction or provide guidance on where in the library's lifecycle I should be checking and creating the user on the resource server? I tried implementing this in the callbackSuccessComponent but the /api/me endpoint keeps getting a 401 because the bearer token is not set yet with useOidcFetch();

Additional Information:

Any advice or documentation references would be greatly appreciated.

Versions

Screenshots

Expected

Actual

Additional Details