# Get data from API

**URL:** <https://discuss.dev.twitch.com/t/get-data-from-api/25783>\
**Category:** API\
**Created:** [May 20, 2020, 9:57am UTC](https://discuss.dev.twitch.com/t/get-data-from-api/25783 "2020-05-20T09:57:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![megatw20](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@megatw20](https://discuss.dev.twitch.com/u/megatw20)\
**Post date:** [May 20, 2020, 9:57am UTC](https://discuss.dev.twitch.com/t/get-data-from-api/25783/1 "2020-05-20T09:57:43Z")

</div>

Hi everyone,  
Could you please help me with this issue about Invalid OAuth token when I tried to get data from “[https://api.twitch.tv/helix/games/top](https://api.twitch.tv/helix/games/top)”  
I used npm module “request” to get the data. However, when I call the request, the terminal shows the status code is 401 because of the “Invalid OAuth token”

 ![image](https://d2opxh93rbxzdn.cloudfront.net/original/2X/2/244c745415da463bdde8f168ab8356ac864bed8c.png)

Very appreciated that if somebody can help me with this issue

---

<div class="post-metadata">

**Author:** ![Simbe](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/simbe/32/4527_2.png) [@Simbe](https://discuss.dev.twitch.com/u/Simbe)\
**Post date:** [May 20, 2020, 10:07am UTC](https://discuss.dev.twitch.com/t/get-data-from-api/25783/2 "2020-05-20T10:07:47Z")

</div>

Just guessing based on the name but is ‘mySecretID’ your Client Secret you got from dev console?

---

<div class="post-metadata">

**Author:** ![megatw20](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@megatw20](https://discuss.dev.twitch.com/u/megatw20)\
**Post date:** [May 20, 2020, 10:14am UTC](https://discuss.dev.twitch.com/t/get-data-from-api/25783/3 "2020-05-20T10:14:04Z")

</div>

Yes, I got it from the Client Secret of dev console.

---

<div class="post-metadata">

**Author:** ![Breci](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/breci/32/5635_2.png) [@Breci](https://discuss.dev.twitch.com/u/Breci)\
**Post date:** [May 20, 2020, 10:19am UTC](https://discuss.dev.twitch.com/t/get-data-from-api/25783/4 "2020-05-20T10:19:27Z")

</div>

your secret is not an oauth token 🙂  
You can use it to get an oauth token 😃

> **[Authentication](https://dev.twitch.tv/docs/authentication/)**
>
> Authentication

---

<div class="post-metadata">

**Author:** ![megatw20](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@megatw20](https://discuss.dev.twitch.com/u/megatw20)\
**Post date:** [May 20, 2020, 11:42am UTC](https://discuss.dev.twitch.com/t/get-data-from-api/25783/5 "2020-05-20T11:42:38Z")

</div>

Thank you very much, I got the data!!!

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [June 19, 2020, 11:44am UTC](https://discuss.dev.twitch.com/t/get-data-from-api/25783/6 "2020-06-19T11:44:05Z")

</div>

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