4.2.2 Using user pools with Bayun AWSS3 wrapper 'SecureAuthentication'
Here User Registration, SignUp Confirmation, SignIn, SignOut needs to be done with SecureAuthentication instance.
Before creating SecureAuthentication instance, user have to declear these following parameters of AWS and Bayun which will be further used by Bayun AWSS3 wrapper 'SecureAuthentication'.
window._config = {
cognito: {
userPoolId: "<userPoolId>", // e.g. us-east-2_uXboG5pAb
region: "<region>", // e.g. us-east-2
clientId: "<clientId>", // e.g. 7asdfvasdasdufe7hf47fhasd
},
};
const BayunConstants = {
BAYUN_APP_ID: "<BAYUN_APP_ID>", // provided on admin panel
BAYUN_APP_SALT: "<BAYUN_APP_SALT>", // provided on admin panel
BAYUN_APP_SECRET: "<BAYUN_APP_SECRET>", // provided on admin panel
ENABLE_FACE_RECOGNITION: false | true,
BASE_URL: "<BASE_URL>", // provided on admin panel
};Set Up the SecureAuthentication object
The SecureAuthentication is a JavaScript class, and must be provided with companyName before using it.
Register a User
Use SecureAuthentication's method register to register a new user instead of relying on standard AWS SDK's signUp method.
Confirm Signup
Confirm a users' sign up with the confirmation code using SecureAuthentication's confirmSignUp method. Use this method instead of CognitoUser's method, to confirm signup with both Cognito and Bayun.
Sign in a user
Use SecureAuthentication's signIn method to get a session, using email and password, with both Cognito and Bayun, instead of CognitoUser's method.
Sign out a user
Use SecureAuthentication's signOut method to clear all tokens and logout of Bayun as well, instead of using CognitoUser's method. User will have to go through the authentication process to get tokens.
Last updated