How to use the aws-appsync/lib/link/auth-link.AUTH_TYPE.AWS_IAM function in aws-appsync

To help you get started, we’ve selected a few aws-appsync 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 alanbo / serverless-cms / back_end / functions / resize-images / storeImageDataGraphQL.ts View on Github external
setItem: function (key, value) {
    this.store[key] = value
  },
  // @ts-ignore
  removeItem: function (key) {
    delete this.store[key]
  }
};

import 'isomorphic-fetch';
import { AUTH_TYPE } from 'aws-appsync/lib/link/auth-link';
import AWSAppSyncClient from 'aws-appsync';

const url = process.env.GRAPHQL;
const region = 'us-west-2';
const type = AUTH_TYPE.AWS_IAM;
import AWS from 'aws-sdk';
const credentials = AWS.config.credentials;

// Import gql helper and craft a GraphQL query
const gql = require('graphql-tag');
const mutation = gql(`
mutation PutImage($input: ImageInput!) {
  putImage(input: $input) {
    id
    name
    lastModified
    filename
    paths {
      path
      type
    }
github alanbo / serverless-cms / back_end / functions / render-pages / queryGQL.ts View on Github external
this.store[key] = value
  },
  // @ts-ignore
  removeItem: function (key) {
    delete this.store[key]
  }
};

import 'isomorphic-fetch';
import { AUTH_TYPE } from 'aws-appsync/lib/link/auth-link';
import AWSAppSyncClient from 'aws-appsync';
import { DocumentNode } from 'graphql';

const url = process.env.GRAPHQL;
const region = process.env.AWS_REGION;
const type = AUTH_TYPE.AWS_IAM;
import AWS from 'aws-sdk';

AWS.config.update({
  region,
  credentials: new AWS.Credentials(process.env.AWS_ACCESS_KEY_ID, process.env.AWS_SECRET_ACCESS_KEY, process.env.AWS_SESSION_TOKEN)
});

const credentials = AWS.config.credentials;

// Set up Apollo client
const client = new AWSAppSyncClient({
  url,
  region,
  auth: {
    type: type,
    credentials: credentials,
github gnemtsov / ab-app2 / frontend / src / index.jsx View on Github external
console.log(
                `[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`
            )
        );
    if (networkError) console.log(`[Network error]: ${networkError}`);
});

AWS.config.update({ region: "eu-west-1" });
const appSyncLink = createAppSyncLink({
    url:
        process.env.NODE_ENV === "development"
            ? process.env.REACT_APP_LOCAL_APPSYNC_URL
            : "https://vipqqwuxvfdn7gaos7u4aav3su.appsync-api.eu-west-1.amazonaws.com/graphql",
    region: "eu-west-1",
    auth: {
        type: AUTH_TYPE.AWS_IAM,
        credentials: new AWS.CognitoIdentityCredentials({
            IdentityPoolId: "eu-west-1:dffe4e03-9e89-4118-911f-ee327e257d9f"
        })
    }
});

const link = ApolloLink.from([authLink, errorLink, appSyncLink]);

const client = new AWSAppSyncClient({ disableOffline: true }, { link });

const app = (
    
        
            
                {client => }