Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the OAuthWithAuthorizationCode class.
 /// </summary>
 /// <param name="clientId">
 /// The client identifier corresponding to your registered application.
 /// </param>
 /// <param name="optionalClientSecret">
 /// The client secret corresponding to your registered application, or null if your app is a desktop or mobile app.
 /// </param>
 /// <param name="redirectionUri">
 /// The URI to which the user of the app will be redirected after receiving user consent.
 /// </param>
 /// <param name="environment">Bing Ads API environment</param>
 /// <remarks>
 /// <para>
 /// For more information about using a client identifier for authentication, see <see href="https://tools.ietf.org/html/rfc6749#section-3.1">Client Password Authentication section of the OAuth 2.0 spec</see>
 /// </para>
 /// <para>
 /// For web applications, redirectionUri must be within the same domain of your registered application.
 /// For more information, see <see href="https://tools.ietf.org/html/rfc6749#section-2.1.1">Redirection Uri section of the OAuth 2.0 spec</see>.
 /// </para>
 /// </remarks>
 protected OAuthWithAuthorizationCode(string clientId, string optionalClientSecret, Uri redirectionUri, ApiEnvironment?environment)
     :  base(clientId, environment)
 {
     _optionalClientSecret = optionalClientSecret;
     _oauthService         = new UriOAuthService(Environment);
     _redirectionUri       = redirectionUri ?? _oauthService.RedirectionUri();
 }
 /// <summary>
 /// Initializes a new instance of the OAuthDesktopMobileImplicitGrant class with the specified ClientId.
 /// </summary>
 /// <param name="clientId">
 /// The client identifier corresponding to your registered application.
 /// </param>
 /// <param name="environment">Bing Ads API environment</param>
 /// <remarks>
 /// For more information about using a client identifier for authentication, see
 /// <see href="https://tools.ietf.org/html/rfc6749#section-3.1">Client Password Authentication section of the OAuth 2.0 spec</see>.
 /// </remarks>
 public OAuthDesktopMobileImplicitGrant(
     string clientId,
     ApiEnvironment?environment = ApiEnvironment.Production,
     bool requireLiveConnect    = false)
     : base(clientId, environment, requireLiveConnect)
 {
     _oauthService   = new UriOAuthService(Environment);
     _redirectionUri = _oauthService.RedirectionUri(requireLiveConnect);
 }