Imgur.API.Endpoints.Impl.OAuth2Endpoint.GetAuthorizationUrl C# (CSharp) Method

GetAuthorizationUrl() public method

Creates an authorization url that can be used to authorize access to a user's account.
public GetAuthorizationUrl ( OAuth2ResponseType oAuth2ResponseType, string state = null ) : string
oAuth2ResponseType OAuth2ResponseType Determines if Imgur returns a Code, a PIN code, or an opaque Token.
state string /// This optional parameter indicates any state which may be useful to your application upon receipt of /// the response. ///
return string
        public string GetAuthorizationUrl(OAuth2ResponseType oAuth2ResponseType, string state = null)
        {
            var responseType = oAuth2ResponseType.ToString().ToLowerInvariant();
            var url =
                $"{AuthorizationEndpointUrl}?client_id={ApiClient.ClientId}&response_type={responseType}&state={state}";
            return url;
        }

Usage Example

コード例 #1
0
 public void GetAuthorizationUrl_SetStateNull_AreEqual()
 {
     var client = new ImgurClient("xyz", "deb");
     var endpoint = new OAuth2Endpoint(client);
     var expected = "https://api.imgur.com/oauth2/authorize?client_id=xyz&response_type=Code&state=";
     Assert.AreEqual(expected, endpoint.GetAuthorizationUrl(OAuth2ResponseType.Code, null));
 }
All Usage Examples Of Imgur.API.Endpoints.Impl.OAuth2Endpoint::GetAuthorizationUrl