Fix link json again (#12)

Use id token instead of access token
This commit is contained in:
John Wu
2021-02-03 08:35:06 -08:00
committed by GitHub
parent 42870e10c2
commit 98bcab5b81
7 changed files with 8 additions and 8 deletions

View File

@@ -12,7 +12,7 @@ export const UserProvider = ({ children }) => {
if (!localStorage) return;
const token = JSON.parse(localStorage.getItem("token"));
if (!token) return;
const { accessToken: { jwtToken }} = token;
const { idToken: { jwtToken }} = token;
const verifyToken = async (accessToken) => {
const result = await auth.verify(accessToken);
if (result.authenticated) {
@@ -100,7 +100,7 @@ export const UserProvider = ({ children }) => {
const signedIn = (token) => {
setToken(token);
if (!localStorage || !token || !token.accessToken) return;
if (!localStorage || !token || !token.idToken) return;
localStorage.setItem("token", JSON.stringify(token));
}