Created
January 20, 2022 00:30
-
-
Save danjesus/6da3efcb7aa50a1443283c701731de2f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const authProvider = { | |
login: () => { | |
return Auth.federatedSignIn({ | |
provider: CognitoHostedUIIdentityProvider.Google, | |
}) | |
}, | |
checkError: (error:any) => { return Promise.resolve() }, | |
checkAuth: async () => { | |
const session = await Auth.currentSession(); | |
console.log(session) | |
debugger; | |
}, | |
logout: () => { return Auth.signOut() }, | |
getIdentity: async() => { | |
const user = await Auth.currentAuthenticatedUser(); | |
return user; | |
}, | |
getPermissions: async (params: any) => { | |
const session = await Auth.currentSession(); | |
const groups = session.getAccessToken().decodePayload()["cognito:groups"]; | |
return groups ? Promise.resolve(groups) : Promise.reject(); | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment