React SPA w/ express server - on login give express user_id

I have a database that i’m storing the auth0 user_id in, and when a user logs into the web app, it would be great to check to see if that user_id exists in the database table.

to do that it seems like express needs the token on login, but the SPA seems to handle the authentication flow, and does not engage the express api until there is an explicit http request that passes the token to the server that engages with checkJwt.

does anyone have any good ideas about how to get the user_id to the server as soon as the user logs in?

i’m wrapping the <Auth0ProviderWithHistory> around my <App> approach.

Hi @kiro,

You could handle the user_id update in a rule instead of in your SPA. Rules execute after authentication, so you could send the user ID to your API at that point before redirecting to your React app. You can call your own API by following this FAQ:

1 Like

these are the droids. :upside_down_face:

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.