Last active
October 19, 2021 07:54
-
-
Save mnanchev/6540dda159634e70d91fce7798294984 to your computer and use it in GitHub Desktop.
Login
This file contains hidden or 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
async function login(email, password) { | |
try { | |
const cognito = new AWS.CognitoIdentityServiceProvider(); | |
return await cognito.initiateAuth({ | |
AuthFlow: 'USER_PASSWORD_AUTH', | |
ClientId: 'XXXXXXXXXXXXXXXXXXX', | |
AuthParameters: { | |
USERNAME: email, | |
PASSWORD: password, | |
}, | |
}).promise(); | |
} catch (err) { | |
throw err; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment