//Auth public async Task <bool> RefreshToken() { if (this.Auth.AccessTokenExpired) { this.Auth = await this.GetAuth().ConfigureAwait(false); return(!this.Auth.AccessTokenExpired); } var req = new LogoutRefreshRequest(this.Credentials.ClientID, "", this.Auth.RefreshToken); try { var t = DateTime.Now; var ar = await Request.Send(this.AuthURL, HttpMethod.Post, "/token/refresh", "", req).ConfigureAwait(false); this.Auth = (TokenResponse)Util.Deserialize(ar.Body, typeof(TokenResponse)); this.Auth.Acquired = t; return(!ar.HasError); } catch (Exception e) { this.Auth = new TokenResponse(); throw e; } }
public async Task <bool> Logout() { if (!this.Auth.AccessTokenExpired) { var req = new LogoutRefreshRequest(this.Credentials.ClientID, this.Auth.AccessToken, this.Auth.RefreshToken); var r = await Request.Send(this.AuthURL, HttpMethod.Post, "/logout", "", req).ConfigureAwait(false); return(!r.HasError); } return(true); }