/// <summary> /// Initialize the token synchronously based on the auth url code. /// </summary> /// <param name="code"></param> public override void InitAccessToken(string code) { IRestRequest request = new RestRequest(Method.POST); request = AddAccessTokenParams(request, code); Token = Execute<AccessTokenModel>(request, AccessTokenUrl); }
/// <summary> /// Initialize the token asynchronously based on the auth url code. /// </summary> /// <param name="code"></param> public override void InitAccessTokenAsync(Action success, Action<HealthGraphException> failure, string code) { IRestRequest request = new RestRequest(Method.POST); request = AddAccessTokenParams(request, code); ExecuteAsync<AccessTokenModel>(request, (token) => { Token = token; success(); }, (ex) => { failure(ex); }, AccessTokenUrl); }
/// <summary> /// Use this constructor if the access token has already been determined. /// </summary> /// <param name="clientId"></param> /// <param name="clientSecret"></param> /// <param name="requestUri"></param> /// <param name="accessToken"></param> public AccessTokenManager(string clientId, string clientSecret, string requestUri, string accessToken) : this(clientId, clientSecret, requestUri) { Token = new AccessTokenModel { AccessToken = accessToken, TokenType = DefaultTokenType }; }