Skip to content

Demo for using coprocessors to fetch authentication token for Apollo Connectors

License

Notifications You must be signed in to change notification settings

apollosolutions/connectors-auth-demo

Repository files navigation

Connectors authorization example


The code in this repository is experimental and has been provided for reference purposes only. Community feedback is welcome but this project may not be supported in the same way that repositories in the official Apollo GraphQL GitHub organization are. If you need help you can file an issue on this repository, contact Apollo to talk to an expert, or create a ticket directly in Apollo Studio.


Requirements:

  • Rover
  • Deno (For the coprocessor and mock API. Your coprocessor can be written in any language.)

Make a .env file:

cp .env-sample .env

Edit the file to add your GraphOS API keys and graphref:

export APOLLO_KEY=<YOUR API KEY HERE>
export APOLLO_GRAPH_REF=<YOUR GRAPH REF HERE>
export APOLLO_ROVER_DEV_ROUTER_VERSION=2.0.0-preview.1

Run the coprocessor (and demo API):

./coprocessor.ts

Run rover dev:

source .env
rover dev --supergraph-config supergraph.yaml --router-config router.yaml

Visit http://localhost:4000/ and run this operation:

query Me {
  me {
    id
  }
}

Use the Connector Debugger to see that the API request contains a header with the authentication token.

About

Demo for using coprocessors to fetch authentication token for Apollo Connectors

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published