All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.sonallux.spotify.api.authorization.ApiAuthorizationProvider Maven / Gradle / Ivy

The newest version!
package de.sonallux.spotify.api.authorization;

public interface ApiAuthorizationProvider {
    /**
     * Get the value for the Authorization header that should be added to a request. This method
     * will be called for every request, so always the latest authentication token can be used.
     * If no Authorization header should be added to the request null can be returned.
     * @return the value of the Authorization header or null
     */
    String getAuthorizationHeaderValue();

    /**
     * Callback to initiate a token refresh after a 401 Unauthorized response from the Spotify Web API.
     * If this operation is not supported or failed, return false.
     * A return value of true indicates that the failing request should be retried.
     * The {@link ApiAuthorizationProvider#getAuthorizationHeaderValue()} method will be called again
     * to get the new header with the new token
     * @return true to indicate to successful token refresh, otherwise false
     */
    boolean refreshAccessToken();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy