403 Erro proibido usando formulários Windows
/* Use Rest Client
https://www.nuget.org/packages/RestSharp/
*/
var client = new RestClient("https://example.com/openam/oauth2/access_token?grant_type=authorization_code&realm=/cbpgatqa");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddHeader("Cache-Control", "no-cache");
request.AddHeader("Authorization", "Basic MzE4OGQwYjQtZTRlOC00MTZjLTg5NjAtZDNlYWFhMmNjY2IxOkx3NiVBa0x4NWtPM01rJTJ5RWwxbW1jR0ZYZmhTQmk1NHhIRCpzNiUyVUd5WXN0MCNVbyNMNWQhcVlpZE93djc=");
request.AddParameter("undefined", "code=" + AuthCode + "&redirect_uri=http%3A%2F%2Flocalhost%3A8080", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
using (var ms = new MemoryStream(Encoding.Unicode.GetBytes(response.Content)))
{
// Deserialization from JSON
DataContractJsonSerializer deserializer = new DataContractJsonSerializer(typeof(Token));
Token token = (Token)deserializer.ReadObject(ms);
return userinfo= GetuserInfo(token.id_token);
}
A Very Strange Serval