achedeuzot / ueberauth_auth0

Auth0 OAuth2 strategy for Überauth.
https://hexdocs.pm/ueberauth_auth0
MIT License
71 stars 46 forks source link

Pass organization_name and invite parameters during the redirect #202

Closed hexedpackets closed 1 year ago

hexedpackets commented 2 years ago

As described in #185, the invitation parameter needs to be passed to the Auth0 redirect for organization invites.

I also added the organization_name, which is an optional parameter.

achedeuzot commented 2 years ago

Thanks for the pull request @hexedpackets 😻

From the Auth0 documentation (and quote of the corresponding text, emphasis mine): https://auth0.com/docs/manage-users/organizations/configure-organizations/invite-members#configure-the-uri

The route in your application must accept invitation and organization parameters through the query string. To start the invitation acceptance transaction, it should forward both parameters along with the end-user to your Auth0 /authorize endpoint.

To support multi-tenant scenarios where the organization name is used as a subdomain or path variable in your application (for example, acme.myapp.com), an organization_name parameter is also included in the invitation link sent to users. This parameter does not need to be sent to /authorize.

For example, if you have an organization-enabled application with an Application Login URI set to https://myapp.com/login, then the link sent in the email invitation that an end-user receives will be: https://myapp.com/login?invitation={invitation_ticket_id}&organization={organization_id}&organization_name={organization_name}.

Your application should initiate a transaction to /authorize that contains the provided invitation and organization key-value pairs.

Question: from what I'm reading on the auth0 docs, there's no need to forward the organization_name parameter. Should we include it in this change ?