public class AuthorizeResource extends Object
| Constructor and Description |
|---|
AuthorizeResource(SonosApiClient apiClient)
Constructor for AuthorizeResource.
|
| Modifier and Type | Method and Description |
|---|---|
SonosToken |
createToken(String redirectUri,
String authorizeCode)
Generate a token from an authorization code (see getAuthorizeCode methods in the same class)
|
String |
generateStateValue()
Noddy implementation for generating a random state value.
|
URI |
getAuthorizeCodeUri(String redirectUri)
Return the URI that a user needs to visit, in order to begin the OAuth process
|
URI |
getAuthorizeCodeUri(String redirectUri,
String state)
Return the URI that a user needs to visit, in order to begin the OAuth process
|
SonosToken |
refreshToken(String refreshToken)
Generate a token from a previously issued refresh token
|
public AuthorizeResource(SonosApiClient apiClient)
Constructor for AuthorizeResource.
apiClient - a SonosApiClient object.public URI getAuthorizeCodeUri(String redirectUri, String state) throws URISyntaxException
redirectUri - - the URI (registered with Sonos in the developer portal) to redirect the user tostate - - strongly recommended, but ultimately optional, state value to pass to Sonos to reduce
chance of CSRFURISyntaxException - if you've passed something in that's invalidpublic URI getAuthorizeCodeUri(String redirectUri) throws URISyntaxException
redirectUri - - the URI (registered with Sonos in the developer portal) to redirect the user toURISyntaxException - if you've passed something in that's invalidpublic SonosToken createToken(String redirectUri, String authorizeCode) throws SonosApiClientException, SonosApiError
redirectUri - - the user-accessible web service URI that Sonos will redirect back toauthorizeCode - - an authorization code obtained before calling this methodSonosToken object containing the user's token informationSonosApiClientException - if unable to build the request due to invalid contentSonosApiError - if there is an error generating the token (from Sonos)public SonosToken refreshToken(String refreshToken) throws SonosApiClientException, SonosApiError
refreshToken - - the refresh token to useSonosToken object containing the user's token informationSonosApiClientException - if unable to build the request due to invalid content or the call failsSonosApiError - if there is an error generating the token (from Sonos)public String generateStateValue()
Copyright © 2018. All rights reserved.