oidc-client icon indicating copy to clipboard operation
oidc-client copied to clipboard

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

Open uhexos opened this issue 8 months ago • 0 comments

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:

  • I'm using the latest version of the AXA OIDC React library
  • My resource server is a springboot application.
  • I'm planning to use the access token obtained from the library to make requests to the resource server.
  • Also using react query

Any advice or documentation references would be greatly appreciated.

Versions

Screenshots

Expected

Actual

Additional Details

  • Installed packages:

uhexos avatar Jun 08 '24 00:06 uhexos