Error 403 when request token with Authorization code

website

(4535992) #1

Hi, i just started to use Skecthfab and i created a simple asp.net post request for get the token authorizations like show on oauth from sketchfab but i keep getting the error 403 can anyone help me to find out what i missing? i put the code i used for the simple post in asp.net :

string CLIENT_ID = "XXXXXX";
string REDIRECT_URI = "XXXXXX";
string AUTHORIZE_URL = "https://sketchfab.com/oauth2/authorize/";

Dictionary fields = new Dictionary();
fields.Add("response_type", "code");
fields.Add("client_id", HttpUtility.UrlEncode(CLIENT_ID));
fields.Add("redirect_uri", HttpUtility.UrlEncode(REDIRECT_URI));

Dictionary headers = new Dictionary();
headers.Add("x-frame-options", "DENY");
headers.Add("Referer", REDIRECT_URI);

using (var client = new HttpClient())
{
foreach (KeyValuePair pair in headers) client.DefaultRequestHeaders.Add(pair.Key, pair.Value);
HttpContent content = new FormUrlEncodedContent(fields);
HttpResponseMessage response = await client.PostAsync(AUTHORIZE_URL, content);
string responseString = string.Empty;
if (response.IsSuccessStatusCode) //failed return always 403
{
responseString = await response.Content.ReadAsStringAsync();
}
return responseString;

        }

Ty in advance for any help.