Example #1
0
    /**
    * do process authorization
    * 
    * @param array $options  Authorization options
    */

    public AccessToken authenticate(AuthorizationCode options)
    {
        string authenticate_url = null;
        authenticate_url = _client.request_client(_client.secure) + "://" + _client.host + _client.path + "/" + _client.api_version + "/oauth/token/";
        _accesstoken = new AccessToken();
        return _accesstoken.getAccessToken(authenticate_url, options);
    }
Example #2
0
 /**
 * Set access token
 * 
 * @param string $token
 */
 
 public void setToken( AccessToken token) {
    HttpContext.Current.Session["gocoin_access_token"] = token.access_token;
    this.token = token.access_token;
 }
Example #3
0
 /**
 * Get authorization code and setToken
 *  if process is done successfully, return true else return false
 * @return boolean
 */
 
 public bool get_token_from_request() {  
     string authcode = HttpContext.Current.Request.QueryString["code"];
     if (authcode != null)
     {
         auth_code = authcode;
         AuthorizationCode code = new AuthorizationCode();
         code.client_id = this.client_id;
         code.client_secret = this.client_secret;
         code.code = this.auth_code;
         code.grant_type = "authorization_code";
         code.redirect_uri = this.redirect_uri;
         auth_result = new AccessToken();
         this._auth = new Auth(this);
         auth_result = _auth.authenticate(code);
         this.setToken(auth_result);
         return true;
     }
     else
     {
         return false;
     }
 }