# getaccessToken( api\_data is empty)

**URL:** <https://discuss.dev.twitch.com/t/getaccesstoken-api-data-is-empty/29854>\
**Category:** API\
**Created:** [January 8, 2021, 6:15pm UTC](https://discuss.dev.twitch.com/t/getaccesstoken-api-data-is-empty/29854 "2021-01-08T18:15:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rinato](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/rinato/32/11098_2.png) [@rinato](https://discuss.dev.twitch.com/u/rinato)\
**Post date:** [January 8, 2021, 6:15pm UTC](https://discuss.dev.twitch.com/t/getaccesstoken-api-data-is-empty/29854/1 "2021-01-08T18:15:44Z")

</div>

I want getaccessToken

result is api\_data empty  
code:  
[https://id.twitch.tv/oauth2/token?client\_id=kibma1m0y8vlyqal82yn8f2exsknrs&client\_secret=REMOVED&code=REMOVE&grant\_type=authorization\_code&redirect\_uri=http%3A%2F%2Flocalhost%2Feasycodeis\_includes%2Flogin.php](https://id.twitch.tv/oauth2/token?client_id=kibma1m0y8vlyqal82yn8f2exsknrs&client_secret=REMOVED&code=REMOVE&grant_type=authorization_code&redirect_uri=http%3A%2F%2Flocalhost%2Feasycodeis_includes%2Flogin.php)

Admin: removed leaked client secret

---

<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:** [January 8, 2021, 6:18pm UTC](https://discuss.dev.twitch.com/t/getaccesstoken-api-data-is-empty/29854/2 "2021-01-08T18:18:23Z")

</div>

Please do not leak your client secret, it’s a violation of the developer agreement and considered a password.

Do you have any code you are using? Just a URL doesn’t tell us much

---

<div class="post-metadata">

**Author:** ![rinato](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/rinato/32/11098_2.png) [@rinato](https://discuss.dev.twitch.com/u/rinato)\
**Post date:** [January 8, 2021, 6:30pm UTC](https://discuss.dev.twitch.com/t/getaccesstoken-api-data-is-empty/29854/3 "2021-01-08T18:30:02Z")

</div>

![2](https://d2opxh93rbxzdn.cloudfront.net/original/2X/8/833622f4d78232677c7812bf8e5997624c312d07.jpeg)

---

<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:** [January 8, 2021, 6:34pm UTC](https://discuss.dev.twitch.com/t/getaccesstoken-api-data-is-empty/29854/4 "2021-01-08T18:34:15Z")

</div>

Seems “correct”

So you’ll need to add some error catching/testing the HTTP response/status code

For a user access token my PHP example might help

> <https://github.com/BarryCarlyon/twitch_misc/blob/master/authentication/user_access_generator/php/index.php#L38>

is the relevant snippet for converting a code to an access token

---

<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:** [February 7, 2021, 6:34pm UTC](https://discuss.dev.twitch.com/t/getaccesstoken-api-data-is-empty/29854/5 "2021-02-07T18:34:18Z")

</div>

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