Skip to content

Conversation

Eijebong
Copy link
Contributor

The former has been unmaintained for 5 years. I was looking at why the login button wasn't working on first load and fell into a rabbit hole...

Regarding the update, this is fairly "straightforward". We now use the context provided with the auth0-react library instead of reinventing the wheel and having our own. The auth0 library also sets up its own callback things so we don't need to set that up manually anymore either.

The main pain point was figuring out how to know within the axios interceptors whether we were logged in or not as calling getAccessTokenSilently will try to log you in if you're not (do not ask me why... I already didn't have hair anymore before but it's way worse now). Turned out that we could use getIdTokenClaims for this. I would've loved to set/unset the interceptor based on the isAuthenticated boolean we can get from auth0 but the interceptor also sets the base URL so we can't do that or it breaks the heartbeat request.

This was reverted in #3429 after it broke staging. Once we have confirmation from the IAM team about the auth0 config we should reland this or modify it accordingly

@Eijebong Eijebong requested a review from a team as a code owner June 26, 2025 15:49
Copy link
Contributor

@bhearsum bhearsum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fine. I gave it a basic test locally, and aside from still hitting the issue where I need to reload before the "Sign In" button works, it worked fine.

The former has been unmaintained for 5 years. I was looking at why the
login button wasn't working on first load and fell into a rabbit hole...

Regarding the update, this is fairly "straightforward". We now use the
context provided with the auth0-react library instead of reinventing the
wheel and having our own. The auth0 library also sets up its own
callback things so we don't need to set that up manually anymore either.

The main pain point was figuring out how to know within the axios
interceptors whether we were logged in or not as calling
`getAccessTokenSilently` will try to log you in if you're not (do not
ask me why... I already didn't have hair anymore before but it's way
worse now). Turned out that we could use `getIdTokenClaims` for this. I
would've loved to set/unset the interceptor based on the `isAuthenticated`
boolean we can get from auth0 but the interceptor also sets the base URL
so we can't do that or it breaks the heartbeat request.
@Eijebong Eijebong merged commit ce2e38d into mozilla-releng:main Jul 15, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants