Package com.auth0

Class AuthorizeUrl

java.lang.Object
com.auth0.AuthorizeUrl

public class AuthorizeUrl extends Object
Class to create and customize an Auth0 Authorize URL. It's not reusable.
  • Method Details

    • withOrganization

      public AuthorizeUrl withOrganization(String organization)
      Sets the organization query string parameter value used to login to an organization.
      Parameters:
      organization - The ID of the organization to log the user in to.
      Returns:
      the builder instance.
    • withInvitation

      public AuthorizeUrl withInvitation(String invitation)
      Sets the invitation query string parameter to join an organization. If using this, you must also specify the organization using withOrganization(String).
      Parameters:
      invitation - The ID of the invitation to accept. This is available on the URL that is provided when accepting an invitation.
      Returns:
      the builder instance.
    • withConnection

      public AuthorizeUrl withConnection(String connection)
      Sets the connection value.
      Parameters:
      connection - connection to set
      Returns:
      the builder instance
    • withSecureCookie

      public AuthorizeUrl withSecureCookie(boolean secureCookie)
      Sets whether cookies used during the authentication flow have the Secure attribute set or not. By default, cookies will be set with the Secure attribute if the responseType includes id_token and thus requires the SameSite=None cookie attribute set. Setting this to false will not override this behavior, as clients will reject cookies with SameSite=None unless the Secure attribute is set. While not guaranteed by all clients, generally a cookie with the Secure attribute will be rejected unless served over HTTPS.
      Parameters:
      secureCookie - whether to always set the Secure attribute on all cookies.
      Returns:
      the builder instance.
    • withAudience

      public AuthorizeUrl withAudience(String audience)
      Sets the audience value.
      Parameters:
      audience - audience to set
      Returns:
      the builder instance
    • withState

      public AuthorizeUrl withState(String state)
      Sets the state value.
      Parameters:
      state - state to set
      Returns:
      the builder instance
    • withNonce

      public AuthorizeUrl withNonce(String nonce)
      Sets the nonce value.
      Parameters:
      nonce - nonce to set
      Returns:
      the builder instance
    • withScope

      public AuthorizeUrl withScope(String scope)
      Sets the scope value.
      Parameters:
      scope - scope to set
      Returns:
      the builder instance
    • withParameter

      public AuthorizeUrl withParameter(String name, String value)
      Sets an additional parameter.
      Parameters:
      name - name of the parameter
      value - value of the parameter to set
      Returns:
      the builder instance
    • build

      public String build() throws IllegalStateException
      Creates a string representation of the URL with the configured parameters. It cannot be called more than once.
      Returns:
      the string URL
      Throws:
      IllegalStateException - if it's called more than once
    • fromPushedAuthorizationRequest

      public String fromPushedAuthorizationRequest() throws InvalidRequestException
      Executes a Pushed Authorization Request (PAR) and uses the request_uri to construct the authorize URL.
      Returns:
      the authorize URL as a string.
      Throws:
      InvalidRequestException - if there is an error when making the request.
      See Also: