Muhammad Ali
11/07/2021, 2:14 AMaws cognito-idp sign-up
... but i have to provide a rest endpoint for user so that they can do signup themselves (and do challenge to confirm signup).
I mean there must be a library from aws-cdk
which provides user signup from backend code?Omi Chowdhury
11/07/2021, 2:38 AMOmi Chowdhury
11/07/2021, 2:40 AMChad (cysense)
11/07/2021, 3:50 AMFrank
Ross Coundon
11/07/2021, 8:22 AMimport { Auth, API } from 'aws-amplify';
const { user } = await Auth.signUp({
username: userData.email,
password: userData.password,
attributes: {
email: userData.email,
},
});
Ross Coundon
11/07/2021, 8:24 AMimport Amplify, { Auth } from 'aws-amplify';
Amplify.configure({
Auth: {
mandatorySignIn: true,
region: amplifyConfig.cognito.REGION,
userPoolId: amplifyConfig.cognito.USER_POOL_ID,
userPoolWebClientId: amplifyConfig.cognito.APP_CLIENT_ID,
},
API: {
endpoints: [
{
name: 'omw',
endpoint: amplifyConfig.apiGateway.URL,
region: amplifyConfig.apiGateway.REGION,
custom_header: async () => {
const token = (await Auth.currentSession())
.getIdToken()
.getJwtToken();
return {
Authorization: `Bearer ${token}`,
};
},
},
],
},
})
Muhammad Ali
11/08/2021, 3:28 PMRoss Coundon
11/08/2021, 4:59 PMMuhammad Ali
11/09/2021, 3:15 PMRoss Coundon
11/09/2021, 3:21 PMawait Auth.confirmSignUp(username, code);