C# Класс PinSharp.PinterestAuthClient

Показать файл Открыть проект

Открытые методы

Метод Описание
BuildAuthorizationUrl ( string clientId, string redirectUri, Scopes scopes ) : string

Generates a login URL with the required parameters. Users will need to visit this URL to authorize your app to use the API on their behalf.

If they accept they will be redirected to the redirectUri with two query string parameters - "state" and "code".

Call BuildAuthorizationUrl if you want to specify the state value yourself to be able to prevent spoofing.

"code" is used with GetAccessTokenAsync to get an access token to use with PinterestClient.

BuildAuthorizationUrl ( string clientId, string redirectUri, Scopes scopes, string state ) : string

Generates a login URL with the required parameters. Users will need to visit this URL to authorize your app to use the API on their behalf.

If they accept they will be redirected to the redirectUri with two query string parameters - "state" and "code".

"state" verifies that this comes from you. "code" is used with GetAccessTokenAsync to get an access token to use with PinterestClient.

CreateRandomState ( int length = 10 ) : string

Generates a random string that you can use to verify that the redirect back to your site or app wasn't spoofed.

Pass this to BuildAuthorizationUrl to get the correct login URL.

GetAccessTokenAsync ( string clientId, string clientSecret, string code, string apiVersion = "v1" ) : Task

Gets an access token which you can then use with PinterestClient.

Приватные методы

Метод Описание
GetScope ( Scopes scopes ) : string

Описание методов

BuildAuthorizationUrl() публичный статический Метод

Generates a login URL with the required parameters. Users will need to visit this URL to authorize your app to use the API on their behalf.

If they accept they will be redirected to the redirectUri with two query string parameters - "state" and "code".

Call BuildAuthorizationUrl if you want to specify the state value yourself to be able to prevent spoofing.

"code" is used with GetAccessTokenAsync to get an access token to use with PinterestClient.

public static BuildAuthorizationUrl ( string clientId, string redirectUri, Scopes scopes ) : string
clientId string The Client ID (also known as App ID) of your app. See https://developers.pinterest.com/apps/
redirectUri string /// The URL you want your user to be redirected to after authorizing your app. /// The code needed for will be added as query string parameter "code". ///
scopes Scopes The scopes you want to request from the user.
Результат string

BuildAuthorizationUrl() публичный статический Метод

Generates a login URL with the required parameters. Users will need to visit this URL to authorize your app to use the API on their behalf.

If they accept they will be redirected to the redirectUri with two query string parameters - "state" and "code".

"state" verifies that this comes from you. "code" is used with GetAccessTokenAsync to get an access token to use with PinterestClient.

public static BuildAuthorizationUrl ( string clientId, string redirectUri, Scopes scopes, string state ) : string
clientId string The Client ID (also known as App ID) of your app. See https://developers.pinterest.com/apps/
redirectUri string /// The URL you want your user to be redirected to after authorizing your app. /// The code needed for will be added as query string parameter "code". ///
scopes Scopes The scopes you want to request from the user.
state string A string that is added to as query string parameter "state". This is to prevent spoofing.
Результат string

CreateRandomState() публичный статический Метод

Generates a random string that you can use to verify that the redirect back to your site or app wasn't spoofed.

Pass this to BuildAuthorizationUrl to get the correct login URL.

public static CreateRandomState ( int length = 10 ) : string
length int The length of the random string.
Результат string

GetAccessTokenAsync() публичный статический Метод

Gets an access token which you can then use with PinterestClient.
public static GetAccessTokenAsync ( string clientId, string clientSecret, string code, string apiVersion = "v1" ) : Task
clientId string The Client ID (also known as App ID) of your app. See https://developers.pinterest.com/apps/
clientSecret string The Client secret (also known as App secret) of your app. See https://developers.pinterest.com/apps/
code string The code that was passed to your redirectUri as a query string parameter.
apiVersion string The API version. Defaults to "v1" if left out.
Результат Task