Package com.spotify.sdk.android.auth
Class TokenExchangeRequest
- java.lang.Object
-
- com.spotify.sdk.android.auth.TokenExchangeRequest
-
public class TokenExchangeRequest extends java.lang.Object
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 Classes Modifier and Type Class Description static class
TokenExchangeRequest.Builder
Builder class for creating TokenExchangeRequest instances.
-
Constructor Summary
Constructors Constructor Description TokenExchangeRequest(java.lang.String clientId, java.lang.String code, java.lang.String redirectUri, java.lang.String codeVerifier)
Creates a new token exchange request.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TokenExchangeResponse
execute()
Executes the token exchange request synchronously.
-
-
-
Constructor Detail
-
TokenExchangeRequest
public TokenExchangeRequest(@NonNull java.lang.String clientId, @NonNull java.lang.String code, @NonNull java.lang.String redirectUri, @NonNull java.lang.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 Detail
-
execute
@NonNull public TokenExchangeResponse 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
-
-