Login token is retrieved but not stored.
This commit is contained in:
@@ -2,7 +2,7 @@ import React from "react";
|
||||
import "./App.css";
|
||||
|
||||
import { auth, createUserProfileDocument } from "../firebase/firebase.utils";
|
||||
import { gql } from "apollo-boost";
|
||||
// import { gql } from "apollo-boost";
|
||||
|
||||
import firebase from "../firebase/firebase.utils"
|
||||
|
||||
@@ -27,16 +27,15 @@ class App extends React.Component {
|
||||
componentDidMount() {
|
||||
const { setCurrentUser } = this.props;
|
||||
this.unsubscribeFromAuth = auth.onAuthStateChanged(async userAuth => {
|
||||
console.log("userAuth", userAuth);
|
||||
if (userAuth) {
|
||||
const token = await userAuth.getIdToken();
|
||||
console.log("token", token);
|
||||
console.log("User auth token", token);
|
||||
const idTokenResult = await userAuth.getIdTokenResult();
|
||||
const hasuraClaim =
|
||||
idTokenResult.claims["https://hasura.io/jwt/claims"];
|
||||
|
||||
if (hasuraClaim) {
|
||||
console.log("status should be in");
|
||||
console.log("status should be in1", hasuraClaim);
|
||||
//setAuthState({ status: "in", user, token });
|
||||
} else {
|
||||
// Check if refresh is required.
|
||||
@@ -48,10 +47,11 @@ class App extends React.Component {
|
||||
// Force refresh to pick up the latest custom claims changes.
|
||||
const token = await userAuth.getIdToken(true);
|
||||
//setAuthState({ status: "in", user, token });
|
||||
console.log("status should be in");
|
||||
console.log("status should be in2");
|
||||
});
|
||||
}
|
||||
} else {
|
||||
console.log("else statement.")
|
||||
//setAuthState({ status: "out" });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user