Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

403 forbidden error using Windows Forms

/* 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);
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: class combining 
Csharp :: c# list double min max 
Csharp :: c# linq unique by property 
Csharp :: unity c# script for movement left and right 
Csharp :: asp.net mvc class="" inline select 
Csharp :: How to enumerate an enum 
Csharp :: httprequestmessage with authorization .net 5 
Csharp :: unity sprite blurry when far 
Csharp :: c# capitalize first letter of each word 
Csharp :: f sharp functions calling each other 
Csharp :: player not following slide object unity 2d 
Csharp :: Find Number of Repetitions of Substring 
Csharp :: temp^late php table for mysql 
Csharp :: Delegate parameter no return 
Csharp :: make tooltip disappear c# 
Csharp :: satisfactory controller support 
Csharp :: enable asnotracking in asp.net core at global level 
Csharp :: afaik 
Csharp :: c# extend array 
Csharp :: .net 6 foreach only if not null 
Csharp :: input string was not in a correct format convert to double 
Csharp :: blender how to switch cameras 
Csharp :: c# show hidden window wpf 
Csharp :: user input in c# 
Csharp :: internal static object ds 
Csharp :: C# program to implement the Quadratic Formula 
Csharp :: hacking 
Csharp :: there is no renderer attached to the gameobject 
Csharp :: flutterwave c# api integration 
Csharp :: how to if i enter 1 go to this program C# 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =