# oAuth Authentication problem

**URL:** <https://discuss.dev.twitch.com/t/oauth-authentication-problem/14784>\
**Category:** API\
**Created:** [March 16, 2018, 4:16pm UTC](https://discuss.dev.twitch.com/t/oauth-authentication-problem/14784 "2018-03-16T16:16:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryuzockt](https://avatars.discourse-cdn.com/v4/letter/r/96bed5/32.png) [@ryuzockt](https://discuss.dev.twitch.com/u/ryuzockt)\
**Post date:** [March 16, 2018, 4:16pm UTC](https://discuss.dev.twitch.com/t/oauth-authentication-problem/14784/1 "2018-03-16T16:16:10Z")

</div>

Hi  
im working on a bot Teamspeakbot wich gives useres the twitch sub group when they join the server.

When a user authorizes the application, the oauth key gets saved in a mysql database that the bot can get the auth key and check that the user is sub.

But now i have the problem that the key always changes 😕

Is there a way to get a fixed oauth, or someone has a better idea?

Greets

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [March 16, 2018, 5:42pm UTC](https://discuss.dev.twitch.com/t/oauth-authentication-problem/14784/2 "2018-03-16T17:42:23Z")

</div>

> [@ryuzockt](#):
>
> But now i have the problem that the key always changes 😕
> 
> Is there a way to get a fixed oauth, or someone has a better idea?

Changes?

It’ll only change/update if the user auths again.

A given oAuth token may expire, in that case you need to use the refresh token and refresh the oAuth token

---

<div class="post-metadata">

**Author:** ![ryuzockt](https://avatars.discourse-cdn.com/v4/letter/r/96bed5/32.png) [@ryuzockt](https://discuss.dev.twitch.com/u/ryuzockt)\
**Post date:** [March 17, 2018, 5:35pm UTC](https://discuss.dev.twitch.com/t/oauth-authentication-problem/14784/3 "2018-03-17T17:35:59Z")

</div>

I authorized my test account yesterday, but today the oAuth token dont work anymore.

So i have to authorize again and save the new oAuth token to work with it

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [March 17, 2018, 9:22pm UTC](https://discuss.dev.twitch.com/t/oauth-authentication-problem/14784/4 "2018-03-17T21:22:43Z")

</div>

You should refer to this section of the docs about using the refresh token to obtain a new oAuth token [https://dev.twitch.tv/docs/authentication/#refreshing-access-tokens](https://dev.twitch.tv/docs/authentication/#refreshing-access-tokens)

---

<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:** [April 16, 2018, 9:22pm UTC](https://discuss.dev.twitch.com/t/oauth-authentication-problem/14784/5 "2018-04-16T21:22:47Z")

</div>

Closed on April 16, 2018, 9:22pm UTC

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