/// <summary> /// Initializes a new instance of the <see cref="pokitdokcsharp.OauthApplicationClient"/> class. /// </summary> /// <param name="clientId">Client identifier.</param> /// <param name="clientSecret">Client secret.</param> /// <param name="requestTimeout">Request timeout.</param> /// <param name="accessToken">Access token.</param> /// <param name="redirectUrl">The Platform App redirect url.</param> /// <param name="tokenRefresh">Invoked when access token is refreshed.</param> /// <param name="scope">The requested scopes</param> /// <param name="authCode">The authorization code recieved by the scope grant of the Platform App</param> public OauthApplicationClient( string clientId, string clientSecret, int requestTimeout = DEFAULT_TIMEOUT, OauthAccessToken accessToken = null, Uri redirectUrl = null, TokenRefreshDelegate tokenRefresh = null, string[] scope = null, string authCode = null) { this._clientId = clientId; this._clientSecret = clientSecret; this._requestTimeout = requestTimeout; if (accessToken != null) { this.AccessToken = accessToken; } this._redirectUrl = redirectUrl; this._tokenRefresh = tokenRefresh; this._scope = scope; this._authCode = authCode; // Force use of TLS 1.2 ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; }
/// <summary> /// Initializes a new instance of the <see cref="pokitdokcsharp.PlatformClient"/> class. /// </summary> /// <param name="clientId">Client identifier.</param> /// <param name="clientSecret">Client secret.</param> /// <param name="requestTimeout">Request timeout.</param> /// <param name="accessToken">Access token.</param> /// <param name="redirectUrl">The application OAuth2 redirect url.</param> /// <param name="tokenRefresh">Method to invoke when access token refresh save occurs.</param> /// <param name="scope">Array of OAuth2 scopes requested</param> /// <param name="authCode">The code received from an authorization code grant flow.</param> public PlatformClient( string clientId, string clientSecret, int requestTimeout = DEFAULT_TIMEOUT, OauthAccessToken accessToken = null, Uri redirectUrl = null, TokenRefreshDelegate tokenRefresh = null, string[] scope = null, string authCode = null ) : base(clientId, clientSecret, requestTimeout, accessToken, redirectUrl, tokenRefresh, scope, authCode) { init(); this.ApiBaseUrl = _apiSite + _versionPath; this.ApiTokenUrl = _apiSite + _tokenPath; this.ApiLogoutUrl = _apiSite + _logoutPath; this.UserAgent = string.Format("csharp-pokitdok/{0}", typeof(PlatformClient).Assembly.GetName().Version); }
/// <summary> /// Initializes a new instance of the <see cref="pokitdokcsharp.OauthApplicationClient"/> class. /// </summary> /// <param name="clientId">Client identifier.</param> /// <param name="clientSecret">Client secret.</param> /// <param name="requestTimeout">Request timeout.</param> /// <param name="accessToken">Access token.</param> /// <param name="redirectUrl">The Platform App redirect url.</param> /// <param name="tokenRefresh">Invoked when access token is refreshed.</param> /// <param name="scope">The requested scopes</param> /// <param name="authCode">The authorization code recieved by the scope grant of the Platform App</param> public OauthApplicationClient( string clientId, string clientSecret, int requestTimeout = DEFAULT_TIMEOUT, OauthAccessToken accessToken = null, Uri redirectUrl = null, TokenRefreshDelegate tokenRefresh = null, string[] scope = null, string authCode = null) { this._clientId = clientId; this._clientSecret = clientSecret; this._requestTimeout = requestTimeout; if (accessToken != null) { this.AccessToken = accessToken; } this._redirectUrl = redirectUrl; this._tokenRefresh = tokenRefresh; this._scope = scope; this._authCode = authCode; // Force use of TLS 1.2 ServicePointManager.SecurityProtocol = (SecurityProtocolType) 3072; }
/// <summary> /// Initializes a new instance of the <see cref="pokitdokcsharp.OauthApplicationClient"/> class. /// </summary> /// <param name="clientId">Client identifier.</param> /// <param name="clientSecret">Client secret.</param> /// <param name="requestTimeout">Request timeout.</param> /// <param name="accessToken">Access token.</param> /// <param name="redirectUrl">The Platform App redirect url.</param> /// <param name="tokenRefresh">Invoked when access token is refreshed.</param> /// <param name="scope">The requested scopes</param> /// <param name="authCode">The authorization code recieved by the scope grant of the Platform App</param> public OauthApplicationClient( string clientId, string clientSecret, int requestTimeout = DEFAULT_TIMEOUT, OauthAccessToken accessToken = null, Uri redirectUrl = null, TokenRefreshDelegate tokenRefresh = null, string[] scope = null, string authCode = null) { this._clientId = clientId; this._clientSecret = clientSecret; this._requestTimeout = requestTimeout; if (accessToken != null) { this.AccessToken = accessToken; } this._redirectUrl = redirectUrl; this._tokenRefresh = tokenRefresh; this._scope = scope; this._authCode = authCode; }