Skip to content

Commit cd7c394

Browse files
authored
fix(auth): Fix the auth redirect provider to no longer obliterate user claims on load. Our login redirect work added a new Provider for auth that overwrite the existing provider, but the new Provider didn't handle the extra cases around user claims that the old provider did (so we could not implement role-based auth. The new provider is unnecessary, so this change switches back the old fully-functioned Provider. (#1952)
1 parent a495491 commit cd7c394

File tree

3 files changed

+5
-22
lines changed

3 files changed

+5
-22
lines changed

components/auth/Provider.tsx

Lines changed: 0 additions & 21 deletions
This file was deleted.

components/auth/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ export * from "./service"
33
export { default as SignInWithButton } from "./SignInWithButton"
44
export { default as SignOut } from "./SignOut"
55
export * from "./types"
6-
export { Provider } from "./Provider"

pages/admin.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ function requireAdmin(Component: React.FC<{}>) {
1717
const { claims } = useAuth()
1818
const router = useRouter()
1919

20+
// TODO: This will cause a blank screen to show for logged out users, but
21+
// a redirect to the home page for logged-in non-admin users.
22+
// This should ideally be a consistent experience for both sets of users,
23+
// but not worth the effort to implement right now.
24+
// Worth revisiting if we either expand our admins or add more admin-only pages.
2025
useEffect(() => {
2126
if (claims && claims?.role !== "admin") {
2227
router.push({ pathname: "/" })

0 commit comments

Comments
 (0)