Create repoditory error 403

I want to create a git repository from an asp application use github api.

To do this, I created an application in the settings (I got the keys)
Then logged in GET   scope - repo and public_repo
Got access_token using

WebClient wc = new WebClient();

NameValueCollection parameters = new NameValueCollection();
parameters.Add("client_id", id);
parameters.Add("client_secret", secret);
parameters.Add("code", code);

var response = wc.UploadValues("", parameters);

next i try to create a repository

NameValueCollection parameters1 = new NameValueCollection();
            parameters1.Add("name", "test-app");

            wc.Headers.Set("Authorization", "token " + access_token);
            wc.Headers.Set("User-Agent", "Mozilla/5.0");
                var response1 = wc.UploadValues($"", parameters1);
            catch(Exception ex)
                var asd = ex;

And get error 403 Forbidden.

What am i doing wrong help please.


requests work


requests are falling 403 Forbidden


I’m not familiar with the .NET WebClient framework, so I’m not going to be much help debugging what might be going wrong with your code. Can you execute the request to create the repository using curl or httpie and share the result?