f / f/graphql.js

JSON parse error when using OAuth token

Open
#35 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.3k
Forks
88
PR merge metrics
No merged PRs in 30d

Description

I've got this to work using Postman, however the following code generates a JSON parse error?

## Code
```js
const graphql = require('graphql.js');
const graph = graphql('https://api.github.com/graphql', {
method: "POST",
headers: {
"User-Agent": "node",
"Authorization": "Bearer "
}
});

const query = graph(`query { viewer { login name } }`);

query().then(
res => console.log(JSON.stringify(res)),
err => console.error(err)
);
```

## Error

```sh
{ message: 'Problems parsing JSON',
documentation_url: 'https://developer.github.com/v4' }
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.