How to use the aws-appsync/lib/link/auth-link.AUTH_TYPE.API_KEY 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 aws-samples / aws-serverless-appsync-app / App.js View on Github external
import NewDestinationsSubscription from './Queries/NewDestinationsSubscription';

import AWSAppSyncClient from "aws-appsync";
import { Rehydrated } from 'aws-appsync-react';
import { AUTH_TYPE } from "aws-appsync/lib/link/auth-link";
import { graphql, ApolloProvider, compose } from 'react-apollo';
import * as AWS from 'aws-sdk';
import AppSync from './aws-exports.js';
import AllDestinationsQuery from './Queries/AllDestinationsQuery';
import NewDestinationMutation from './Queries/NewDestinationMutation';

const client = new AWSAppSyncClient({
  url: AppSync.aws_appsync_graphqlEndpoint,
  region: AppSync.aws_appsync_region,
  auth: {
      type: AUTH_TYPE.API_KEY,
      apiKey: AppSync.aws_appsync_apiKey,

      // type: AUTH_TYPE.AWS_IAM,
      // Note - Testing purposes only
      /*credentials: new AWS.Credentials({
          accessKeyId: AWS_ACCESS_KEY_ID,
          secretAccessKey: AWS_SECRET_ACCESS_KEY
      })*/

      // Amazon Cognito Federated Identities using AWS Amplify
      //credentials: () => Auth.currentCredentials(),

      // Amazon Cognito user pools using AWS Amplify
      // type: AUTH_TYPE.AMAZON_COGNITO_USER_POOLS,
      // jwtToken: async () => (await Auth.currentSession()).getIdToken().getJwtToken(),
  },
github GantMan / ReactStateMuseum / ReactNative / AppSync / App.js View on Github external
ScrollView
} from 'react-native'
import ListItems from './Components/listItems'
import AddItems from './Components/addItems'
// The AppSync Import Bus
import AWSAppSyncClient from 'aws-appsync'
import { Rehydrated } from 'aws-appsync-react'
import { AUTH_TYPE } from 'aws-appsync/lib/link/auth-link'
import { ApolloProvider } from 'react-apollo'
import AppSync from './AppSync.js'

const client = new AWSAppSyncClient({
  url: AppSync.graphqlEndpoint,
  region: AppSync.region,
  auth: {
    type: AUTH_TYPE.API_KEY,
    apiKey: AppSync.apiKey
  }
})

class App extends Component {
  state = { allItems: [] }
  render () {
    return (
github GantMan / ReactStateMuseum / React / appsync / src / index.js View on Github external
import AWSAppSyncClient from "aws-appsync";
import { Rehydrated } from "aws-appsync-react";
import { AUTH_TYPE } from "aws-appsync/lib/link/auth-link";
import { ApolloProvider } from "react-apollo";
import AppSync from "./AppSync.js";

const styles = {
  fontFamily: "sans-serif",
  textAlign: "center"
};

const client = new AWSAppSyncClient({
  url: AppSync.graphqlEndpoint,
  region: AppSync.region,
  auth: {
    type: AUTH_TYPE.API_KEY,
    apiKey: AppSync.apiKey
  }
});

export default class App extends Component {
  state = { allItems: [] };

  render() {
    return (
      <div style="{styles}">
        <h2>Welcome to GraphQL + Amazon AppSync</h2>
        <em>
          Please be clean in your list, as this is shared across all examples
        </em>
        
        </div>
github FE-Kits / fe-boilerplates / framework / react / graphql / src / index.js View on Github external
import AWSAppSyncClient from "aws-appsync";
import { Rehydrated } from "aws-appsync-react";
import { AUTH_TYPE } from "aws-appsync/lib/link/auth-link";
import { ApolloProvider } from "react-apollo";
import AppSync from "./AppSync.js";

const styles = {
  fontFamily: "sans-serif",
  textAlign: "center"
};

const client = new AWSAppSyncClient({
  url: AppSync.graphqlEndpoint,
  region: AppSync.region,
  auth: {
    type: AUTH_TYPE.API_KEY,
    apiKey: AppSync.apiKey
  }
});

export default class App extends Component {
  state = { allItems: [] };

  render() {
    return (
      <div style="{styles}">
        <h2>Welcome to GraphQL + Amazon AppSync</h2>
        <em>
          Please be clean in your list, as this is shared across all examples
        </em>
        
        </div>