Class 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 application
        code - The authorization code received from the authorization server
        redirectUri - The redirect URI used in the authorization request
        codeVerifier - 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