Switch user organisation without re-login

I’m using the embedded login with auth0-js.

I have a user who is a member of two different organisations.

The user goes to my login page, where they identify which organisation they want to log into. Next they input their email and password. Then the WebAuth.login method is called with the supplied credentials and organisation_id. My backend receives the code which it then uses to obtain the access_token and the refresh_token, and uses the access_token to retrieve the user’s info.

Now I want to let the user easily switch to another organisation, without having to input their credentials again.

Is there any way I can exchange the access_token and/or refresh_token for a new pair of tokens for the same user, but in a different organisation?

Hi there @fiodor welcome to the community!

You should be able to accomplish this using silent authentication - In particular, you will need to utilize the prompt param of webAuth.authorize()

Hope this helps get the ball rolling!

Hi @tyf.

I have tried this method already, but it does not work in my case. There’s no way to explicitly pass access_token or refresh_token to this method (I’m assuming it expects cookies set by universal login). When I tried it I got an error to the tune of “authentication required”.

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