Skip to content

Instantly share code, notes, and snippets.

@Integralist
Last active May 1, 2018 17:08
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 Integralist/f04b2ac395bd6ded45efcfb4fceec5a4 to your computer and use it in GitHub Desktop.
Save Integralist/f04b2ac395bd6ded45efcfb4fceec5a4 to your computer and use it in GitHub Desktop.
[AWS Amplify Tips] #aws #amplify #cognito #js #javascript

Enable debug log

window.LOG_LEVEL = 'DEBUG';

Disable analytics

The noise in the debug logs is insane:

import { Analytics } from 'aws-amplify';

Analytics.disable();

Manual Configuration

import Amplify,{Auth} from 'aws-amplify';

Amplify.configure({
  Auth: {
    identityPoolId: '...',
    region: '...',
    userPoolId: '...',
    userPoolWebClientId: '...',
  }
});

Sign Up

const phone = this.state.phone.trim();

var attributes = {
    email: email,
    name: fullname
}

if (phone) {
    attributes['phone_number'] = phone;
}

Auth.signUp({
    username: username,
    password: password,
    attributes: attributes
})
.then(
    this.setState(() => {
        return {
            enterAuth: true
        }
    })
)
.catch( err => {
    console.log(username, password, email, phone, fullname);
    console.log(err);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment