« Back to Index

[AWS Amplify Tips]

View original Gist on GitHub

Tags: #aws #amplify #cognito #js #javascript

AWS Amplify Tips.md

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);
})