Skip to content

Commit

Permalink
fix: user id key
Browse files Browse the repository at this point in the history
  • Loading branch information
Gitarcitano committed Jul 4, 2021
1 parent 0650942 commit e4aee25
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/auth/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Button, View } from 'react-native';
import type { LoginProps } from './interfaces';
import { startOAuthFlow } from './service';
import { setStorageItem } from '../storage';
import jwtDecode, { JwtPayload } from 'jwt-decode';

export function Login({
issuer,
Expand All @@ -21,14 +20,10 @@ export function Login({
additionalParameters,
});

const userId = jwtDecode<JwtPayload>(oAuthResponse.idToken).sub;

console.log('userId: ', userId);
console.log('oAuthResponse: ', oAuthResponse);

await setStorageItem('userApiToken', oAuthResponse.idToken);
await setStorageItem('userRefreshToken', oAuthResponse.refreshToken);
await setStorageItem('userId', userId);
Promise.all([
setStorageItem('userApiToken', oAuthResponse.idToken),
setStorageItem('userRefreshToken', oAuthResponse.refreshToken),
]);
}
return (
// eslint-disable-next-line react-native/no-inline-styles
Expand Down

0 comments on commit e4aee25

Please sign in to comment.