Package com.spotify.sdk.android.auth
Class TokenExchangeRequest
java.lang.Object
com.spotify.sdk.android.auth.TokenExchangeRequest
A utility class for exchanging an authorization code for an access token using PKCE verifier.
This implements the OAuth 2.0 Authorization Code Grant with PKCE as specified in RFC 7636.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class for creating TokenExchangeRequest instances. -
Constructor Summary
ConstructorsConstructorDescriptionTokenExchangeRequest(String clientId, String code, String redirectUri, String codeVerifier) Creates a new token exchange request. -
Method Summary
-
Constructor Details
-
TokenExchangeRequest
public TokenExchangeRequest(@NonNull String clientId, @NonNull String code, @NonNull String redirectUri, @NonNull String codeVerifier) Creates a new token exchange request.- Parameters:
clientId- The client ID of the applicationcode- The authorization code received from the authorization serverredirectUri- The redirect URI used in the authorization requestcodeVerifier- The PKCE code verifier that was used to generate the code challenge
-
-
Method Details
-
execute
Executes the token exchange request synchronously. This method performs a blocking HTTP request and should not be called on the main thread.- Returns:
- TokenExchangeResponse containing the access token or error information
-