Class PKCEOAuthFlow
Object used to execute OAuth through PKCE Use this object to maintain code verifier and challenge using S256 method.
Inheritance
Inherited Members
Namespace: Dropbox.Api
Assembly: Dropbox.Api.dll
Syntax
public class PKCEOAuthFlow
Constructors
| Improve this Doc View SourcePKCEOAuthFlow()
Initializes a new instance of the PKCEOAuthFlow class. Default constructor that also generates code verifier and code challenge to be used in PKCE flow.
Declaration
public PKCEOAuthFlow()
Methods
| Improve this Doc View SourceGetAuthorizeUri(OAuthResponseType, String, String, String, Boolean, Boolean, String, Boolean, TokenAccessType, String[], IncludeGrantedScopes)
Gets the URI used to start the OAuth2.0 authorization flow. Passes in codeChallenge generated in this class.
Declaration
public Uri GetAuthorizeUri(OAuthResponseType oauthResponseType, string clientId, string redirectUri = null, string state = null, bool forceReapprove = false, bool disableSignup = false, string requireRole = null, bool forceReauthentication = false, TokenAccessType tokenAccessType = TokenAccessType.Legacy, string[] scopeList = null, IncludeGrantedScopes includeGrantedScopes = IncludeGrantedScopes.None)
Parameters
Type | Name | Description |
---|---|---|
OAuthResponseType | oauthResponseType | The grant type requested, either |
System.String | clientId | The apps key, found in the App Console. |
System.String | redirectUri | Where to redirect the user after authorization has completed. This must be the exact URI
registered in the App Console; even |
System.String | state | Up to 500 bytes of arbitrary data that will be passed back to |
System.Boolean | forceReapprove | Whether or not to force the user to approve the app again if they've already done so.
If |
System.Boolean | disableSignup | When |
System.String | requireRole | If this parameter is specified, the user will be asked to authorize with a particular type of Dropbox account, either work for a team account or personal for a personal account. Your app should still verify the type of Dropbox account after authorization since the user could modify or remove the require_role parameter. |
System.Boolean | forceReauthentication | If |
TokenAccessType | tokenAccessType | Determines the type of token to request. See TokenAccessType for information on specific types available. If none is specified, this will use the legacy type. |
System.String[] | scopeList | list of scopes to request in base oauth flow. If left blank, will default to all scopes for app. |
IncludeGrantedScopes | includeGrantedScopes | which scopes to include from previous grants. Note: if this user has never linked the app, include_granted_scopes must be None. |
Returns
Type | Description |
---|---|
System.Uri | The uri of a web page which must be displayed to the user in order to authorize the app. |
ProcessCodeFlowAsync(String, String, String, HttpClient)
Processes the second half of the OAuth 2.0 code flow. Uses the codeVerifier created in this class to execute the second half.
Declaration
public Task<OAuth2Response> ProcessCodeFlowAsync(string code, string appKey, string redirectUri = null, HttpClient client = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | code | The code acquired in the query parameters of the redirect from the initial authorize url. |
System.String | appKey | The application key, found in the App Console. |
System.String | redirectUri | The redirect URI that was provided in the initial authorize URI, this is only used to validate that it matches the original request, it is not used to redirect again. |
HttpClient | client | An optional http client instance used to make requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<OAuth2Response> | The authorization response, containing the access token and uid of the authorized user. |
ProcessCodeFlowAsync(Uri, String, String, String, HttpClient)
Processes the second half of the OAuth 2.0 code flow. Uses the codeVerifier created in this class to execute second half.
Declaration
public Task<OAuth2Response> ProcessCodeFlowAsync(Uri responseUri, string appKey, string redirectUri = null, string state = null, HttpClient client = null)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | responseUri | The URI to which the user was redirected after the initial authorization request. |
System.String | appKey | The application key, found in the App Console. |
System.String | redirectUri | The redirect URI that was provided in the initial authorize URI, this is only used to validate that it matches the original request, it is not used to redirect again. |
System.String | state | The state parameter (if any) that matches that used in the initial authorize URI. |
HttpClient | client | An optional http client instance used to make requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<OAuth2Response> | The authorization response, containing the access token and uid of the authorized user. |