Skip to content

Commit

Permalink
Updated the auth mechanism to support browser refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
Fgerthoffert committed Nov 8, 2019
1 parent b48c1d6 commit ff493d1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ui/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('root')
document.getElementById('root'),
);

// If you want your app to work offline and load faster, you can change
Expand Down
10 changes: 10 additions & 0 deletions ui/src/models/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,16 @@ export const global = createModel({
await setAuth0Config();
this.setAuth0Initialized(true);
this.setLoading(false);
const isLoggedIn = await window.Auth0.isAuthenticated();
if (isLoggedIn === true) {
const accessToken = await window.Auth0.getTokenSilently();
const user = await window.Auth0.getUser();
this.setCallbackState({
loggedIn: isLoggedIn,
accessToken,
authUser: user,
});
}
}
}
},
Expand Down

0 comments on commit ff493d1

Please sign in to comment.