Interface OAuth2AuthorizationCodeFlow

All Known Implementing Classes:
GoogleOAuth2AuthorizationCodeFlow, MicrosoftOAuth2AuthorizationCodeFlow

@NullMarked public interface OAuth2AuthorizationCodeFlow
Interface defining the OAuth2 authorization code flow used to connect a mailbox account: the user is redirected to the provider consent page and returns to the application callback with an authorization code.
  • Method Details

    • buildAuthorizationUrl

      String buildAuthorizationUrl(String redirectUri, String state)
      Builds the provider consent page URL.
      Parameters:
      redirectUri - application callback URI registered for the OAuth client
      state - opaque value used to protect the round trip against CSRF
      Returns:
      URL to redirect the user to
    • completeAuthorization

      void completeAuthorization(String authorizationCode, String redirectUri)
      Exchanges the authorization code received on the callback for tokens and stores the obtained refresh token via EmailRefreshTokenManager.
      Parameters:
      authorizationCode - code received on the redirect URI
      redirectUri - the same redirect URI that was used to build the authorization URL
      Throws:
      IllegalStateException - if the exchange fails or the response contains no refresh token