Custom API parameters?

I was wondering if it would be possible to add custom parameters to an API call.
For example I’d like to pass a username from my own user system via the api with the twitch auth and get back the username so I know who made what call. This would help setting up an alternate username during registrations.
Kind of imagine it as…“client_id”&redirect_uri=“redirect_uri”&scope=user_read&state=null&username=“username”
Tried searching but I couldn’t find anything, and I couldn’t find anything under the “callback” that had sufficient information.

The state param should contain everything you might need to keep through auth.

Is that the only one though?
Because while state is good and all, I could theoretically use it for a username, it limits me to 1 extra parameter, how would I say… add age? gender? name?

1 Like

The value for state can contain multiple real values. It could, for example, be state=username,age,current_time_on_Mars. You’ll simply have to process it yourself in your application instead of relying on the web server’s/platform’s URL parsing.

1 Like

Hmm, if that actually works then great!
Thank you : )

A lot of people take some information and base64encode it or similar and shunt that into state and decode it the otherside.

Or make up some identifier, assign that to the session of the user, then redirect to Twitch with that as a the state and use that on the return.

The uses of state are basically limitless, just don’t send toooooo much.

Use a ID or something rather than many many keys

Hmm good idea, I was thinking of what way best to send it, plain text would just introduce too many issues, but this gives me an idea.
Thank you!

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