SHARE
TWEET

Untitled

a guest Aug 20th, 2019 74 in 336 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var authServer = new AuthorizationServerDescription()
  2.             {
  3.                 AuthorizationEndpoint = new Uri("https://test.com/gateway/oauth2/authorize"),
  4.                 TokenEndpoint = new Uri("https://api.test.com/oauth2/access_token")
  5.             };
  6.            
  7.             // client secrets are not provided
  8.             this.Client = new UserAgentClient(authServer, clientIdentifier: "domain.com", //clientsecrets);
  9.             this.Authorization = new AuthorizationState();
  10.             this.Authorization.Scope.Add("full");
  11.             this.Authorization.Callback = new Uri("http://localhost:51068/");
  12.  
  13.             if (!string.IsNullOrEmpty(Request.QueryString["code"]))
  14.             {
  15.                 try
  16.                 {
  17.                     var result = this.Client.ProcessUserAuthorization(Request.Url, this.Authorization);
  18.                     var valueString = string.Empty;
  19.  
  20.                     if (!string.IsNullOrEmpty(this.Authorization.AccessToken))
  21.                     {
  22.                         // does not go here cuz the access token is null
  23.                         valueString = CallAPI(this.Authorization);
  24.                     }
  25.  
  26.                     ViewBag.Values = valueString;
  27.                 }
  28.                 catch (ProtocolException ex)
  29.                 {
  30.                     // TODO
  31.                 }
  32.             }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top