Issue Generating OAuth User Token

I have a chat bot that I want to be able to create clips but I am having trouble generating a User OAuth token for it.

Currently I am just authorizing the bot by navigating to this page in my web browser.

And copying the code received into this

public static void Main(string[] args) {

            string id = "8be7hguk2ntew88z3s2cn3ze98vc2x";
            string secret = "secret";
            string code = "code";

            HttpClient client = new HttpClient();
            var responsetask = client.PostAsync(
                ""+id+"&client_secret="+secret+"&code="+code+"&grant_type=authorization_code&redirect_uri=http://localhost", new StringContent(""));


            var response_string = responsetask.Result.Content.ReadAsStringAsync();



            File.WriteAllText("C:/Users/User/Desktop/Output.txt", response_string.Result);


But I keep receiving this error code {“status”:400,“message”:“Invalid authorization code”}
If anyone knows why this is happening or has another less stupid way I can get the code locally I would appreciate it

This usually means the code has been used twice.

But the URL you created is for implicit auth. (response_type token)

Implicit doesn’t need the second step that you are trying to do as it returns the access_token from the start

These sort of tokens cannot be renewed, so you should probably be using

response_type code

Which does need the second step you are trying to do

Yeah I am using that process I copied the wrong url at first “” is the url im actually using. Wait those links both have the same URL do they not?

This is implicit auth you don’t need the second step

| response_type | auth type | refresh | step two? | You are Using
| token | implicit auth | can’t | no second step | Yes
| code | “normal” auth | can | needs second step | No

Okay but I am trying to get a code that can refresh and I’m doing so by continuing to the second step in that program am I not? I feel like im fundamentally misunderstanding something here.

Should be code not token

I apologize for being so dense I haven’t slept in 2 days. I got the response I expected now

You should sleep

And s’all good it happens

I have Real bad Insomnia so it’s not really a choice. But thanks for your help

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