Using GitHub OAuth - megabit-labs/pathways GitHub Wiki

Generating a temporary code

Read this to learn how to generate a temporary code.

Sending the Code to the Backend

Use this mutation on the GraphQL server with the code you received from GitHub.

mutation {
  GithubAuth(code: "1f7d1aefaa58f98d5446"){
    status
    message
    token
  }
}

In response, you will get a response from the server with a JWT like this:

{
  "data": {
    "GithubAuth": {
      "status": "OK",
      "message": null,
      "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1OTE0Njg3NDl9.UENjBi5c6l6JbUQmQ-aUDClYGuRbwiwIL7R5EMx4KmE"
    }
  }
}

This token is your JWT. Use this token in the Authorization header to authenticate future requests.