Class AuthorizationCodeFlow
- java.lang.Object
-
- de.sonallux.spotify.api.authorization.TokenStoreApiAuthorizationProvider
-
- de.sonallux.spotify.api.authorization.authorization_code.AuthorizationCodeFlow
-
- All Implemented Interfaces:
ApiAuthorizationProvider
public class AuthorizationCodeFlow extends TokenStoreApiAuthorizationProvider
Implements the Authorization Code Flow
-
-
Field Summary
-
Fields inherited from class de.sonallux.spotify.api.authorization.TokenStoreApiAuthorizationProvider
tokenStore
-
-
Constructor Summary
Constructors Constructor Description AuthorizationCodeFlow(String clientId, String clientSecret, String redirectUri)AuthorizationCodeFlow(String clientId, String clientSecret, String redirectUri, TokenStore tokenStore)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AuthorizationUrlBuildercreateAuthorizationUrl()voidexchangeAuthorizationCode(AuthorizationRedirectResponse<String> authResponse)AuthorizationRedirectResponse<String>parseAuthorizationRedirectResponse(String url)booleanrefreshAccessToken()Callback to initiate a token refresh after a 401 Unauthorized response from the Spotify Web API.-
Methods inherited from class de.sonallux.spotify.api.authorization.TokenStoreApiAuthorizationProvider
getAuthorizationHeaderValue
-
-
-
-
Method Detail
-
createAuthorizationUrl
public AuthorizationUrlBuilder createAuthorizationUrl()
-
exchangeAuthorizationCode
public void exchangeAuthorizationCode(AuthorizationRedirectResponse<String> authResponse) throws SpotifyAuthorizationException
- Throws:
SpotifyAuthorizationException
-
refreshAccessToken
public boolean refreshAccessToken()
Description copied from interface:ApiAuthorizationProviderCallback to initiate a token refresh after a 401 Unauthorized response from the Spotify Web API. If this operation is not supported or failed, returnfalse. A return value oftrueindicates that the failing request should be retried. TheApiAuthorizationProvider.getAuthorizationHeaderValue()method will be called again to get the new header with the new token- Specified by:
refreshAccessTokenin interfaceApiAuthorizationProvider- Overrides:
refreshAccessTokenin classTokenStoreApiAuthorizationProvider- Returns:
trueto indicate to successful token refresh, otherwisefalse
-
parseAuthorizationRedirectResponse
public AuthorizationRedirectResponse<String> parseAuthorizationRedirectResponse(String url)
-
-