How to open my GET RestRequest in URL to login

334 Views Asked by At

My problem is for oath2 first auth for client approval (then redirected to a callback url which handle token exchange)

I need to add acr_value to a DotNetOpenAuth client.RequestUserAuthorization process. Can't find a method of doing this so I created the request in Restsharp instead but my Restsharp GET do not redirect user to URL stated in the request. Pls help.

Below is working code in a http post:
(Takes me to server, sign-approval, back to callback)**

DotNetOpenAuth.OAuth2.WebServerClient client = authclass.CreateClient();
client.RequestUserAuthorization(scopes, redirectUri);
return View();

Below is a working request but aren't taking user to URL in GET

public ActionResult XXXXX (object sender, EventArgs e)

string apiServerHost = 
WebConfigurationManager.AppSettings["AuthServerHost"];
var path = string.Format("connect/authorize");

string client_id = WebConfigurationManager.AppSettings["ClientId"];
string client_secret = 
WebConfigurationManager.AppSettings["ClientSecret"];
string redirect_uri = WebConfigurationManager.AppSettings["RedirectUri"];                

var client = new RestClient(apiServerHost);                

client.Authenticator = new HttpBasicAuthenticator(client_id,    
client_secret);

var request = new RestRequest(path, Method.GET);

request.AddHeader("cache-control", "no-cache");
request.AddHeader("redirect_uri", redirect_uri);               
request.AddHeader("scope", "XXXXXXXXX");
request.AddHeader("promt", "login");
request.AddHeader("acr_values", "XXXXXXXXXXX");

IRestResponse response =  client.Execute(request);


return View("XXXX");
0

There are 0 best solutions below