fix: move priority up for token fetching

This commit is contained in:
Wyatt Johnson
2018-10-22 12:25:20 -06:00
parent cff9b29a36
commit 49c7d2eeda
+8 -8
View File
@@ -47,14 +47,6 @@ const getAuthToken = (store, storage) => {
// capable of storing the token in localStorage, then we would have
// persisted it to the redux state.
return state.config.auth_token || state.auth.token;
} else if (
!bowser.safari &&
!bowser.ios &&
storage &&
storage.getItem('token')
) {
// Use local storage auth tokens where there's a stable api.
return storage.getItem('token');
} else if (location.hash && location.hash.startsWith('#access_token=')) {
// Check to see if the access token is living in the URL as a hash.
const token = location.hash.substring(14);
@@ -73,6 +65,14 @@ const getAuthToken = (store, storage) => {
}
return token;
} else if (
!bowser.safari &&
!bowser.ios &&
storage &&
storage.getItem('token')
) {
// Use local storage auth tokens where there's a stable api.
return storage.getItem('token');
}
return null;