# Error invalid Oauth token

**URL:** <https://staging-discuss.dev.twitch.com/t/error-invalid-oauth-token/41904>\
**Category:** API\
**Created:** [November 14, 2022, 2:37pm UTC](https://staging-discuss.dev.twitch.com/t/error-invalid-oauth-token/41904 "2022-11-14T14:37:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![hellobryan](https://avatars.discourse-cdn.com/v4/letter/h/e47c2d/32.png) [@hellobryan](https://staging-discuss.dev.twitch.com/u/hellobryan)\
**Post date:** [November 14, 2022, 2:37pm UTC](https://staging-discuss.dev.twitch.com/t/error-invalid-oauth-token/41904/1 "2022-11-14T14:37:44Z")

</div>

hi, i’m actually triying to send a request but i permanently have the error : Invalid OAuth token, when i use the token i generated on twitch.  
with an error 401 acces denied  
my code :  
export async function Data(url =‘’) {  
const headers = {  
‘Client-ID’: ‘xxx’,  
‘Authorization’: ‘Bearer xxx’

```
  };
  const result = await window.fetch(url, {
    
    headers
  })
    .then(async (data) => await data.json())
    .catch((err) => err.message);
  console.log(result)

```

}  
Data(‘[https://api.twitch.tv/helix/users?login=hirogazeuse](https://api.twitch.tv/helix/users?login=hirogazeuse)’)  
if u have a solution i hug u

---

<div class="post-metadata">

**Author:** ![Dist](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/dist/32/7192_2.png) [@Dist](https://staging-discuss.dev.twitch.com/u/Dist)\
**Post date:** [November 14, 2022, 2:48pm UTC](https://staging-discuss.dev.twitch.com/t/error-invalid-oauth-token/41904/2 "2022-11-14T14:48:58Z")

</div>

As the error would indicate, your OAuth token is invalid, so I’d suggest reading through the [Authentication Docs](https://dev.twitch.tv/docs/authentication) and ensure you’re properly completing one of the OAuth flows.

---

<div class="post-metadata">

**Author:** ![hellobryan](https://avatars.discourse-cdn.com/v4/letter/h/e47c2d/32.png) [@hellobryan](https://staging-discuss.dev.twitch.com/u/hellobryan)\
**Post date:** [November 14, 2022, 6:08pm UTC](https://staging-discuss.dev.twitch.com/t/error-invalid-oauth-token/41904/3 "2022-11-14T18:08:26Z")

</div>

i’m pretty sure i did the good step

---

<div class="post-metadata">

**Author:** ![Dist](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/dist/32/7192_2.png) [@Dist](https://staging-discuss.dev.twitch.com/u/Dist)\
**Post date:** [November 14, 2022, 6:46pm UTC](https://staging-discuss.dev.twitch.com/t/error-invalid-oauth-token/41904/4 "2022-11-14T18:46:51Z")

</div>

If you think you’ve gone through the Authentication process correctly you should be able to use the Validate Token endpoint [https://dev.twitch.tv/docs/authentication/validate-tokens](https://dev.twitch.tv/docs/authentication/validate-tokens) which will tell if if the token is valid or not.

---

<div class="post-metadata">

**Author:** ![hellobryan](https://avatars.discourse-cdn.com/v4/letter/h/e47c2d/32.png) [@hellobryan](https://staging-discuss.dev.twitch.com/u/hellobryan)\
**Post date:** [November 16, 2022, 11:04am UTC](https://staging-discuss.dev.twitch.com/t/error-invalid-oauth-token/41904/5 "2022-11-16T11:04:14Z")

</div>

ok i got a problem with my key probably cause i tried again one day later and it worked, ty btw

---

<div class="post-metadata">

**Author:** ![system](https://d2spem0quai2ol.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://staging-discuss.dev.twitch.com/u/system)\
**Post date:** [December 16, 2022, 11:05am UTC](https://staging-discuss.dev.twitch.com/t/error-invalid-oauth-token/41904/6 "2022-12-16T11:05:03Z")

</div>

Closed on December 16, 2022, 11:05am UTC

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