How do I get correct OAuth token?

I went to

to get my OAuth token, but when I use
function () {
let fetchLink = ‘’;

      fetch(fetchLink, {
        method: 'get',
        headers: new Headers({
          'Authorization': 'Bearer <oauth token received>',
          'Client-ID': '<my client id>',
          function (response) {
            return response.json();
          data => {

I get status 401 message saying error: Unauthorized and message: Invalid OAuth token.

How do I get the correct OAuth token?

response_type=code is the first step in “user” oAuth and you redirect the user to that page to authenticate.

You probably in fact need an App Access Token, for server to server requests

NodeJS example of getting a token

Got it working by going to the sample link


with scope as viewing_activity_read

The OAuth token from this response works. Not sure why adding the scope=viewing_activity_read works but it works for me.

That is the implicit auth response for a client ID that is not yours.

It’s not advised to use the clientID from the documentation.

Please use you own clientID from

I used my own, I just copy and pasted from the documentation for the forum post only. Thanks Barry.

Also worth noting that for public data (such as games/top) you don’t need any scopes.

But if this is a server application, to routinely fetch/update games/top for your own use, you should be using client credentials as the token you have obtained will only work for 60 days or so

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.