Class AuthorizationCodeFlow
java.lang.Object
de.sonallux.spotify.api.authorization.TokenStoreApiAuthorizationProvider
de.sonallux.spotify.api.authorization.authorization_code.AuthorizationCodeFlow
- All Implemented Interfaces:
ApiAuthorizationProvider
Implements the
Authorization Code Flow
-
Field Summary
Fields inherited from class de.sonallux.spotify.api.authorization.TokenStoreApiAuthorizationProvider
tokenStore -
Constructor Summary
ConstructorsConstructorDescriptionAuthorizationCodeFlow(String clientId, String clientSecret, String redirectUri) AuthorizationCodeFlow(String clientId, String clientSecret, String redirectUri, TokenStore tokenStore) -
Method Summary
Modifier and TypeMethodDescriptionvoidexchangeAuthorizationCode(AuthorizationRedirectResponse<String> authResponse) booleanCallback 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
-
Constructor Details
-
AuthorizationCodeFlow
public AuthorizationCodeFlow(String clientId, String clientSecret, String redirectUri, TokenStore tokenStore) -
AuthorizationCodeFlow
-
-
Method Details
-
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
-