feat[auth]: handle new blocked users and trial expiry in token flow#746
feat[auth]: handle new blocked users and trial expiry in token flow#746braddf wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
| isLoggedIn = true, | ||
| combinedData = null | ||
| combinedData = null, | ||
| children |
There was a problem hiding this comment.
What is children being used for?
There was a problem hiding this comment.
This just allows us to inject child components into the Header when needed, e.g. for this PR having a Sign Out on the Blocked/Access Denied screen (in case a user logs in with the wrong email address to let them still sign out from that page)
| const trialEndsAt = session?.user?.trial_ends_at; | ||
| if (trialEndsAt && new Date(trialEndsAt) < new Date()) { | ||
| return res.status(403).json({ error: "trial_expired", email: session?.user?.email }); | ||
| } |
There was a problem hiding this comment.
Is it possible to write any unit tests for this? Maybe mocking Auth0 is too hard?
There was a problem hiding this comment.
For unit tests yeah definitely too much, but we could try to add a Cypress test for this actually 👍 I'll add to that issue
|
Would be useful to notify us if someone who is blocked or trail expired trys to login |
|
Although perhaps that is better done via an Auth0 workflow |
|
Yeah for sure, let's catch this on the Auth0 side and send a Slack message so it's visible/actionable cross-team 👍 |
Pull Request
Description
Adds proper client-side routing for blocked users and trial-expired users.
Problem: users that are either blocked at login or a refresh token returns a
400 Unauthorizedresponse need to be redirected and shown an appropriate page, likewise with Trial users whose trials have expired.Changes:
Helps with https://github.com/openclimatefix/client-private/issues/200
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.
Please also list any relevant details for your test configuration
Checklist: