Package com.dropbox.core
Class DbxPKCEManager
java.lang.Object
com.dropbox.core.DbxPKCEManager
This class should be lib/jar private. We make it public so that Android related code can use it.
This class does code verifier and code challenge generation in Proof Key for Code Exchange(PKCE).
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionmakeTokenRequest(DbxRequestConfig requestConfig, String oauth2Code, String appKey, String redirectUri, DbxHost host) Make oauth2/token request to exchange code for oauth2 access token.
-
Field Details
-
CODE_CHALLENGE_METHODS
- See Also:
-
CODE_VERIFIER_SIZE
public static final int CODE_VERIFIER_SIZE- See Also:
-
-
Constructor Details
-
DbxPKCEManager
public DbxPKCEManager()This class has state. Each instance has a randomly generated codeVerifier in it. Just like we shouldn't re-use the same code verifier in PKCE, we shouldn't re-use the same DbxPKCEManager instance in different OAuth flow. -
DbxPKCEManager
-
-
Method Details
-
getCodeVerifier
- Returns:
- The randomly generate code verifier in this instance.
-
getCodeChallenge
- Returns:
- The code challenge, which is a hashed code verifier.
-
makeTokenRequest
public DbxAuthFinish makeTokenRequest(DbxRequestConfig requestConfig, String oauth2Code, String appKey, String redirectUri, DbxHost host) throws DbxException Make oauth2/token request to exchange code for oauth2 access token. Client secret is not required.- Parameters:
requestConfig- Default attributes to use for each request.oauth2Code- OAuth2 code defined in OAuth2 code flow.appKey- Client KeyredirectUri- The same redirect_uri that's used in preivous oauth2/authorize call.host- Only used for testing when you don't want to make request against production.- Returns:
- OAuth2 result, including oauth2 access token, and optionally expiration time and refresh token.
- Throws:
DbxException- If reqeust is invalid, or code expired, or server error.
-