-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Two Auth0 Providers #1146
Two Auth0 Providers #1146
Conversation
Click here to see your changes live |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
packages/elements/src/utils.ts
Outdated
@@ -14,9 +14,12 @@ export const validateProps = (props: Record<string, any>, required: string[]) => | |||
const CODE_RE = /[?&]code=[^&]+/; | |||
const STATE_RE = /[?&]state=[^&]+/; | |||
const ERROR_RE = /[?&]error=[^&]+/; | |||
const PARENT_RE = /[?&]photon-parent-auth=[^&]+/; // if this is present, these are auth params for a different Auth0 instance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we are requiring our customer to add photon-parent-auth
, can't we just do the inverse and add a photon=true
flag so our customers don't have to do anything?
This way their client will get he normal redirect, and ours will only get the "inner" one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sam So If I understand correctly:
- we programmatically append
photon=true
to the redirect uri passed into the<photon-client>
- in Photon client, we would check for the presence of
photon=true
- on their side they would still need to add
skipRedirectCallback={window.location.href.includes('photon=true')}
packages/elements/package.json
Outdated
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "@photonhealth/elements", | |||
"version": "0.9.1", | |||
"version": "0.9.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a minor bump
packages/elements/src/utils.ts
Outdated
@@ -14,9 +14,12 @@ export const validateProps = (props: Record<string, any>, required: string[]) => | |||
const CODE_RE = /[?&]code=[^&]+/; | |||
const STATE_RE = /[?&]state=[^&]+/; | |||
const ERROR_RE = /[?&]error=[^&]+/; | |||
const IS_PHOTON_RE = /[?&]photon=true[^&]+/; // if this is present, these are auth params for a different Auth0 instance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we use a regex rather than parsing the search params?
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "@photonhealth/elements", | |||
"version": "0.9.1", | |||
"version": "0.9.1-rc.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samkotlove candidate
We have an issue where a customer is has an Auth0 instance that's in conflict with our Element's instance. What's causing the issue is that both instances are picking up on the redirect url's params. So to solve this I've added a hardcoded param to our elements that won't do any checks if it's coming from the parent.
Any customer that is using their own Auth0 login will need to set
skipRedirectCallback
to look for the presence ofphoton=true
:Then, when as high up in the customer's authenticated tree as possible, the'll place our
photon-client
:🎥 Demo Video
https://www.loom.com/share/58814af997ea4367a705d253ee68a9c3
👀 Demo Branch
https://github.com/Photon-Health/client/tree/auth0
If you go here to
apps/auth
you can install and thennpm run dev
to recreate the scenario I'm showing in the video above.References
auth0/auth0-react#416
This is the PR that allows for multiple contexts. Since we aren't using React, we don't need the context on the parent React component. However in the code there was a hint to the answer.
https://github.com/auth0-samples/auth0-link-accounts-sample/tree/react-variant/React
Here's a demo of the above PR