How to use the @aws-amplify/api.configure function in @aws-amplify/api

To help you get started, we’ve selected a few @aws-amplify/api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TreeHacks / root / src / index.tsx View on Github external
try {
        return { Authorization: (await Auth.currentSession()).getIdToken().getJwtToken() }
    }
    catch (e) {
        console.warn(e, "Defaulting to stored JWT in localStorage...");
        // Get JWT from SAML.
        return { Authorization: await asyncLocalStorage.getItem("jwt") } 
    }
}
Auth.configure({
    region: 'us-east-1',
    userPoolId: COGNITO_USER_POOL_ID,
    userPoolWebClientId: COGNITO_CLIENT_ID,
    mandatorySignIn: false
});
API.configure({
    endpoints: [
        {
            name: "treehacks",
            endpoint: ENDPOINT_URL,
            custom_header: custom_header
        }
    ]
});

const authScreenLabels = {
    en: {
        'Sign Up': 'Create new account',
        'Sign Up Account': 'New member? Create a new account',
        'Sign In Account': 'Sign In'
    }
};
github ashteya / ionic4-tutorial-appsync / src / main.ts View on Github external
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';

import API from '@aws-amplify/api';
import PubSub from '@aws-amplify/PubSub';
import awsConfig from './aws-exports.js';
import Amplify from 'aws-amplify';

PubSub.configure(awsConfig);
API.configure(awsConfig);
Amplify.configure(awsConfig);

if (environment.production) {
  enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule)
  .catch(err => console.log(err));