User switch between Organization

It’s not in the docs yet, you just have to pass it, and the sdk will append it to the /authorize request. You have to make sure you do ignoreCache: true so it’s not returning the same access token.

You have to make sure the application user is auth against enables organization (it’ll ask if it’s organization only or personal use or both), if your application does not enabled for organization, then when you pass in organization parameter it’ll return an error. Also, if you don’t pass in authorization, the user is authenticating against the general connection, which wouldn’t have the org_id because auth0 wouldn’t know which org upon login.

It looks something like this

      const token = await getAccessTokenSilently({
        organization: auth0OrgId,
        ignoreCache: true,
      })

      const decodedToken: AccessToken = decode(token)
2 Likes