Skip to content

Instantly share code, notes, and snippets.

@elliotforbes
Created February 22, 2018 21:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elliotforbes/56794b27aa88497dd40b44ab0aa45244 to your computer and use it in GitHub Desktop.
Save elliotforbes/56794b27aa88497dd40b44ab0aa45244 to your computer and use it in GitHub Desktop.
configure (config) {
if (typeof config !== 'object' || Array.isArray(config)) {
throw new Error('[CognitoAuth error] valid option object required')
}
this.userPool = new CognitoUserPool({
UserPoolId: config.IdentityPoolId,
ClientId: config.ClientId
})
Config.region = config.region
Config.credentials = new CognitoIdentityCredentials({
IdentityPoolId: config.IdentityPoolId
})
this.options = config
}
signup(username, email, pass, cb) {
let attributeList = [
new CognitoUserAttribute({
Name: 'email',
Value: email
})
]
this.userPool.signUp(username, pass, attributeList, null, cb)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment