Custom API Parameters - How?

Hello Twitch Developers!

I’ve used Google and the search function on here so far and i found some interesting informations.

If i understand that right, you can pass custom parameters through the state parameter.
But how can i access the data after the user logged in?

What i tried so far:

send encoded Base64 data over the state Parameter; can’t access it. The JSON Object after login does not contain this.

So, how could this even be realized? Or: Is it even possible?!

Best regards.

The state parameter is a part of OAuth2 to validate that you are receiving back the same request that you sent to the service for authentication and mitigate attacks:

Also, the JSON object doesn’t contain it, it comes back as part of the redirect_uri, from Twitch docs:

Here is a sample response with both an ID token and access token:

https://localhost#access_token=pk2bh6y1vi8mrn7l67bp9i6dpg2wnk
&token_type=bearer
&id_token=eyJhbGciOiJ...A
&state=c3ab8aa609ea11e793ae92361f002671
	&scope=viewing_activity_read

The suggestion is, to encode your original state value before sending it, then upon retrieval, decoding it, and verifying that it is correct.

2 Likes

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