Skip to content

Instantly share code, notes, and snippets.

@und3fined
Last active May 5, 2019 04:56
Show Gist options
  • Save und3fined/3b99814304272258602c5b3587449e92 to your computer and use it in GitHub Desktop.
Save und3fined/3b99814304272258602c5b3587449e92 to your computer and use it in GitHub Desktop.
Sample Apollo GraphQL with Github API

This guide update for Original post: https://medium.com/mindorks/what-is-graphql-and-using-it-on-android-ab8e493abdd7

Please note this guide replace for Step 2 in original post


Before we begin, make sure you have:

  • Node.js v6.9.0 or greater
  • npm 3.10.8 or greater
  • git v2.14.1 or greater

You can check requirement follow command requirements

Install Apollo Codegen

Run command in terminal

npm install -g apollo

How to get a Oauth Token Github

Please follow step-by-step

  1. Login to Github

  2. Go to https://github.com/settings/tokens

  3. Click to button Genereate new token for generate a new oauth token Generate new token

  4. Please check options sample image Pick permission

  5. Save Oauth Token Result

How to download schema.json from Github

Run command in terminal

apollo service:download --endpoint=https://api.github.com/graphql --header="Authorization: Bearer d944c9d296b59c5ae47553707af717—————“

Please replace d944c9d296b59c5ae47553707af717————— with your token

After run command, you can see a file schema.json in current directory in disk.


Now you can continue from line Now make a file with .graphql queries and add following queries in original post

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment