Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.

public final class DefaultAuthorizationCodeTokenResponseClient

  1. Object
  2. DefaultAuthorizationCodeTokenResponseClient

ImplementsOAuth2AccessTokenResponseClient

The exchange over the runtime’s HTTP client, which parks the request’s thread while the provider answers.

The client authenticates the way its registration says: the id and secret in an Authorization: Basic header, as form fields, or – a public client – the id alone. The PKCE verifier goes with every exchange.

Constructors

public DefaultAuthorizationCodeTokenResponseClient()

Methods

public OAuth2AccessTokenResponse getTokenResponse(ClientRegistration registration, OAuth2AuthorizationRequest authorizationRequest, String code)The provider’s answer.
public static String sanitizeErrorCode(String error)The error parameter of a callback, reduced to an error code as RFC 6749 spells one: anything else a provider sent comes back as invalid_request.

Inherited methods

Constructor details

DefaultAuthorizationCodeTokenResponseClient

public DefaultAuthorizationCodeTokenResponseClient()

Method details

getTokenResponse

public OAuth2AccessTokenResponse getTokenResponse(ClientRegistration registration, OAuth2AuthorizationRequest authorizationRequest, String code)

The provider’s answer.

  • OAuth2AuthenticationException: when the provider refuses, cannot be reached, or answers with something that is not a token response

sanitizeErrorCode

public static String sanitizeErrorCode(String error)
The error parameter of a callback, reduced to an error code as RFC 6749 spells one: anything else a provider sent comes back as invalid_request.