Error 404 when creating a POST request to id.twitch.tv/oauth2/token

I am trying to use the Webhooks interface on a bot that will be running all the time and will therefore needs its access token renewing, I have obtained the access token successfully but when trying to get the refresh_token like they do in the docs I am returned with a 404 error, I am using postman to try and troubleshoot this and I am still getting the same results:

I am very new to using the OAuth protocol so it is highly likely that I may of misunderstood something very obvious.

Thanks in advance.

I can’t tell what URL this is calling from the screenshot.

What URL are you trying to call and does it match what postman is actually calling?

This seems to be step 3 of the “OAuth authorization code flow”

Depending on which Webhook topics you are interested in an “App Access”/Client Credentials Token may make more sense to be used

As a side note you should probably run these as two seperate processed.

So that the Bots process is not directly web accessable.

Apologies, https://id.twitch.tv/oauth2/tokenclient_id=blablbalb&client_secret=fofofofofofffo&code=sasdasdasdasdad&grant_type=authorization_code&redirect_uri=http://localhost

I will be using a mixture of the Webhooks and the normal (not sure what is really called) Twitch API. Will I need two access token systems or can I use the same access token for both?

You are missing a ? before client_id so the URL is invalid. But That appears to be present in the postman screenshot (but has a … before it so I had to ask for the URL you are using).

So not sure if you typoed the URL into postman hence the ....? in the screenshot.

I wonder if you have typoed and doubled up your query string bars and bad concatenated the form data

Is a javascript/nodeJS example of Step 3 of Authorization.

You can use the bots token to call webhooks. Webhooks for stream/follow/public data, accepts any valid oAuth, but subscriptions/moderation events will need the broadcasters oAuth.

So you can reduce the key count by using the bots key with webhooks. Personally my webhook handler uses an app access token, so the bots key is kept to the bot for logging in with.

Personally, I have some segregation in my services. So my bot only has the bots token, and doesn’t make any requests to Twitch itself other than to maintain it’s token.

I have a webhooks handler, that for the most part uses the broadcasters/subscriber user access token I have generated for all it’s tokens.

Apologies, again, that was a typo when i was pasting it into the text box, the formatting was odd from postman, this is what the link actually is: https://id.twitch.tv/oauth2/token?client_id=blablbalb&client_secret=fofofofofofffo&code=sasdasdasdasdad&grant_type=authorization_code
&redirect_uri=http://localhost

image

Working as expected here. So not sure why you are getting a 404

I just copied that link i just posted into postman and it works now, god knows what id done, maybe id included a space or something that i didnt notice, regardless, thank you for your help.

1 Like

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