Silent authentication or redirect inside Action if no organization in the request

We have a setup where our auth0 SPA authentication app can authorize regular users or organization members.

Currently, our Users can belong to many organizations, but the most frequent scenario will be that they belong to only one organization.

Our SPA JS app is hosted on a single URL and is connecting to any organization. Consequently, for the moment we don’t have the information about the organization to use until the user is first authenticated.

We don’t want the users to be forced to type their organization’s name at the auth0 login step.

So the flow is as follow:

  • User open the SPA
  • If not authenticated, the user is directed to auth0 for authentication
  • the user is brought back to our SPA. the user must then choose their organization, even if there is only one organization in their profile. We have access to their organizations at this step.
  • We then use the “loginWithPopup()” of the auth0-spa-js library to re-authenticate the user in their organization without leaving the SPA

Ideally, we would like to be able to either silently authenticate a user as an organization Member in an Post-login Action if that user is member of only one organization, or at the least maybe redirect that user from within the Action to bring him to a auth0 organization login so he would ultimately be brought back to our SPA with an organization token in a single transaction.

Is this something feasible?

1 Like

Hi @k2-dev,

Unfortunately, I do not believe that what you are describing is supported at the moment. However, there are improvements planned for early next year that may fit your use-case: Support/Replace Organization prompt screen with "choose organization" during login - #17 by adam.housman

Let us know if the features described there would fit your use-case.

Thanks,
Dave

3 Likes

Hi Dave,

Absolutely, Identifier First Authentication is what we would like to have!

In the meantime, we’ll keep on using the “loginWithPopup()” approach.

1 Like

Hey there!

As this topic is related to Actions and Rules & Hooks are being deprecated soon in favor of Actions, I’m excited to let you know about our next Ask me Anything session in the Forum on Thursday, January 18 with the Rules, Hooks and Actions team on Rules & Hooks and why Actions matter! Submit your questions in the thread above and our esteemed product experts will provide written answers on January 18. Find out more about Rules & Hooks and why Actions matter! Can’t wait to see you there!

Learn more here!

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