-
Notifications
You must be signed in to change notification settings - Fork 0
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
Wire up authenticated API calls in frontend #56
Conversation
import './index.scss'; | ||
|
||
ReactDOM.render( | ||
<React.StrictMode> | ||
<Provider store={store}> |
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.
Any reason for removing strict mode?
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.
Redux Toolkit throws warnings under strict mode.
|
||
export default function App() { | ||
return ( | ||
<HashRouter> | ||
<Suspense fallback={<Loading />}> | ||
<Switch> | ||
<Route exact path="/" component={Home} /> | ||
<PrivateRoute exact path="/" component={Home} /> |
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.
Shouldn't all these paths be route protected?
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.
/id_token
must be non-authenticated since it's our auth callback/entrypoint. Video call could be authenticated if we wanted to.
|
||
function Login() { | ||
return ( | ||
<LoginRedirect> |
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.
Seems a little confusing to nest what looks to be component wrappers to run effects. No action needed, but curious about the thought process here.
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 is mostly a work-around for the fact that hooks shouldn't run conditionally which means that we don't want to add LoginProfile
into LoginRedirect
. The logic to fetch the profile information could of course also be added in another place and I suspect it may move once we have more UI components set up. Feel free to refactor this as you see fit. I mostly just wanted to provide the scafolding for the authentication integration with this pull request.
This pull request integrates the React frontend with the backend AAD B2C authentication. The pull request demonstrates how to force a login via AAD B2C, grab the returned token and use the token to make an authenticated request to our API.
Resolves #4.