Call revoking access_token

Hello!

After I do login I have an access_token. When I close my app I want to revoke this token.

I am trying:

            string url = "https://id.twitch.tv/oauth2/revoke?client_id=MY_CLIENT_ID&token=" + tokenTwitch;

        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
        request.KeepAlive = false;
        request.Method = "POST";
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();

Where
tokenTwitch I get it after I do login.

Hello!

Is it possible?

Please do not bump your own topics.

Revocation is covered here

So not sure what you are asking here?

Hello!

Step by step:

To do a login:

I open this URL in my webBrowser:

                string _url = "https://id.twitch.tv/oauth2/authorize?client_id=___MY_CLIENT_ID___&redirect_uri=http://localhost:8000&response_type=token&scope=channel_read+user:edit+channel_stream";

After this I get the access token. Using the access token I can do some request to API. Works correctly

The next step is do logoff of the user. I use:

            string url = "https://id.twitch.tv/oauth2/revoke?client_id=__MY_CLIENT_ID__&token=" + tokenTwitch;

        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
        request.KeepAlive = false;
        request.ProtocolVersion = HttpVersion.Version11;
        request.Headers.Add("Authorization:OAuth " + tokenTwitch);
        request.Headers.Add("client_id: __MY_CLIENT_ID__");
        request.Method = "POST";
        request.Timeout = 2000;
        request.ContentType = "application/json; charset=UTF-8";

        //request.Accept = "application/json";
        request.Accept = "application/vnd.twitchtv.v5+json";
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();

After did this request I have code result = 200. (OK)

How I can to ask ‘login and password’ to use again when I call:

string _url = “https://id.twitch.tv/oauth2/authorize?client_id=MY_CLIENT_ID&redirect_uri=http://localhost:8000&response_type=token&scope=channel_read+user:edit+channel_stream”;

I need to do logoff of the user.

oh you want to let users change Twitch accounts rather than the automated relink loop?

As documented:

Add

&force_verify=true

to the end of your string _url, that’ll display a more useful dialog Twitch Side letting uses change Twitch Accounts if they need to

Thank you :slight_smile:

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