Class AuthorizationCodeUriRequest.Builder
- java.lang.Object
-
- se.michaelthelin.spotify.requests.AbstractRequest.Builder<URI,AuthorizationCodeUriRequest.Builder>
-
- se.michaelthelin.spotify.requests.authorization.authorization_code.AuthorizationCodeUriRequest.Builder
-
- All Implemented Interfaces:
IRequest.Builder<URI,AuthorizationCodeUriRequest.Builder>
- Enclosing class:
- AuthorizationCodeUriRequest
public static final class AuthorizationCodeUriRequest.Builder extends AbstractRequest.Builder<URI,AuthorizationCodeUriRequest.Builder>
Builder class for building anAuthorizationCodeUriRequest.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
-
Methods inherited from class se.michaelthelin.spotify.requests.AbstractRequest.Builder
setBody, setBodyParameter, setContentType, setDefaults, setHeader, setHost, setHttpManager, setPath, setPathParameter, setPort, setQueryParameter, setScheme
-
-
-
-
Method Detail
-
client_id
public AuthorizationCodeUriRequest.Builder client_id(String client_id)
The client ID setter.- Parameters:
client_id- Required. The client ID provided to you by Spotify when you register your application.- Returns:
- An
AuthorizationCodeUriRequest.Builder.
-
response_type
public AuthorizationCodeUriRequest.Builder response_type(String response_type)
The response type setter.- Parameters:
response_type- Required. Set it to"code".- Returns:
- An
AuthorizationCodeUriRequest.Builder.
-
redirect_uri
public AuthorizationCodeUriRequest.Builder redirect_uri(URI redirect_uri)
The redirect URI setter.- Parameters:
redirect_uri- Required. The URI to redirect to after the user grants/denies permission. This URI needs to have been entered in the Redirect URI whitelist that you specified when you registered your application. The value ofredirect_urihere must exactly match one of the values you entered when you registered your application, including upper/lowercase, terminating slashes, etc.- Returns:
- An
AuthorizationCodeUriRequest.Builder.
-
code_challenge_method
public AuthorizationCodeUriRequest.Builder code_challenge_method(String code_challenge_method)
The code challenge method setter.- Parameters:
code_challenge_method- Required if the Proof Key for Code Exchange (PKCE) flow is used. Set it to"S256".- Returns:
- An
AuthorizationCodeUriRequest.Builder.
-
code_challenge
public AuthorizationCodeUriRequest.Builder code_challenge(String code_challenge)
The code challenge setter.- Parameters:
code_challenge- Required if the Proof Key for Code Exchange (PKCE) flow is used. The code challenge that your app calculated beforehand. The code challenge is the base64url encoded sha256-hash of the code verifier, which is a cryptographically random string between 43 and 128 characters in length. It can contain letters, digits, underscores, periods, hyphens, or tildes and is generated by your app before each authentication request.- Returns:
- An
AuthorizationCodeUriRequest.Builder. - See Also:
- Authorization Code Flow with Proof Key for Code Exchange (PKCE)
-
state
public AuthorizationCodeUriRequest.Builder state(String state)
The state setter.- Parameters:
state- Optional, but strongly recommended. The state can be useful for correlating requests and responses. Because yourredirect_urican be guessed, using a state value can increase your assurance that an incoming connection is the result of an authentication request. If you generate a random string or encode the hash of some client state (e.g., a cookie) in this state variable, you can validate the response to additionally ensure that the request and response originated in the same browser. This provides protection against attacks such as cross-site request forgery.- Returns:
- An
AuthorizationCodeUriRequest.Builder. - See Also:
- RFC 6749: Cross-Site Request Forgery
-
scope
public AuthorizationCodeUriRequest.Builder scope(String scope)
The scope setter.- Parameters:
scope- Optional. A space-separated list of scopes. If no scopes are specified, authorization will be granted only to access publicly available information: that is, only information normally visible in the Spotify desktop, web and mobile players.- Returns:
- An
AuthorizationCodeUriRequest.Builder. - See Also:
- Spotify: Using Scopes
-
scope
public AuthorizationCodeUriRequest.Builder scope(AuthorizationScope... scopes)
-
show_dialog
public AuthorizationCodeUriRequest.Builder show_dialog(boolean show_dialog)
The show dialog setter.- Parameters:
show_dialog- Optional. Whether or not to force the user to approve the app again if they’ve already done so. Iffalse(default), a user who has already approved the application may be automatically redirected to the URI specified byredirect_uri. Iftrue, the user will not be automatically redirected and will have to approve the app again.- Returns:
- An
AuthorizationCodeUriRequest.Builder.
-
build
public AuthorizationCodeUriRequest build()
The request build method.- Returns:
- An
AuthorizationCodeUriRequest.
-
self
protected AuthorizationCodeUriRequest.Builder self()
Description copied from class:AbstractRequest.BuilderReturn this instance to simulate a self-type.- Specified by:
selfin classAbstractRequest.Builder<URI,AuthorizationCodeUriRequest.Builder>- Returns:
- This instance.
-
-