diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-05-16 23:18:02 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-05-18 15:46:42 +0200 |
| commit | a6865b86cc8d710374fc0b6cfcbd2b863f1942a9 (patch) | |
| tree | 121fdb26827c5509a12a4427e8f9d881dbdefe82 /opendc-web/opendc-web-ui/src/components/navigation/Navbar.js | |
| parent | 6412610f38117e1ea0635a56fa023183723fa67a (diff) | |
ui: Migrate to Auth0 as Identity Provider
This change updates the frontend codebase to move away from the Google
login and instead use Auth0 as generic Identity Provider. This allows
users to login with other accounts as well.
Since Auth0 has a free tier, users can experiment themselves with OpenDC
locally without having to pay for the login functionality. The code has
been written so that we should be able to migrate away from Auth0 once
it is not a suitable Identity Provider for OpenDC anymore.
Diffstat (limited to 'opendc-web/opendc-web-ui/src/components/navigation/Navbar.js')
| -rw-r--r-- | opendc-web/opendc-web-ui/src/components/navigation/Navbar.js | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/opendc-web/opendc-web-ui/src/components/navigation/Navbar.js b/opendc-web/opendc-web-ui/src/components/navigation/Navbar.js index f16a3feb..5c9ea1b8 100644 --- a/opendc-web/opendc-web-ui/src/components/navigation/Navbar.js +++ b/opendc-web/opendc-web-ui/src/components/navigation/Navbar.js @@ -15,7 +15,7 @@ import Login from '../../containers/auth/Login' import Logout from '../../containers/auth/Logout' import ProfileName from '../../containers/auth/ProfileName' import { login, navbar, opendcBrand } from './Navbar.module.scss' -import { useIsLoggedIn } from '../../auth' +import { useAuth } from '../../auth' export const NAVBAR_HEIGHT = 60 @@ -44,10 +44,10 @@ export const NavItem = ({ route, children }) => { export const LoggedInSection = () => { const router = useRouter() - const isLoggedIn = useIsLoggedIn() + const { isAuthenticated } = useAuth() return ( <Nav navbar className="auth-links"> - {isLoggedIn ? ( + {isAuthenticated ? ( [ router.asPath === '/' ? ( <NavItem route="/projects" key="projects"> @@ -58,12 +58,10 @@ export const LoggedInSection = () => { </Link> </NavItem> ) : ( - <NavItem route="/profile" key="profile"> - <Link href="/profile"> - <NavLink title="My Profile"> - <ProfileName /> - </NavLink> - </Link> + <NavItem key="profile"> + <NavLink title="My Profile"> + <ProfileName /> + </NavLink> </NavItem> ), <NavItem route="logout" key="logout"> |
