Skip to content

Commit

Permalink
Check authentication based off of picture
Browse files Browse the repository at this point in the history
There is actually a moment in time where the JWT in localStorage is from
Google.  Thus, a user is not really authenticated at that point.
  • Loading branch information
binarymason committed May 15, 2017
1 parent 4d25d4e commit 12ca07b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/reducers/account-reducer.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as types from '../actions/action-types';

const tokenExists = () => 'auth_token' in window.localStorage;
const isAuthenticated = () => 'picture' in window.localStorage;

const INITIAL_STATE = {
isAuthenticated: tokenExists(),
isAuthenticated: isAuthenticated(),
picture: window.localStorage.getItem('picture') || '',
credibility: window.localStorage.getItem('credibility') || '',
account: {
Expand Down Expand Up @@ -32,7 +32,7 @@ const createSession = (info, state) => {
return {
...state,
...info,
isAuthenticated: tokenExists(),
isAuthenticated: isAuthenticated(),
};
};

Expand Down

0 comments on commit 12ca07b

Please sign in to comment.