/** * * @param authToken * The authentication token * @param tokenSecret * @return The Auth object * @throws FlickrException * @see "http://www.flickr.com/services/api/flickr.auth.oauth.checkToken.html" */ public Auth checkToken(String authToken, String tokenSecret) throws FlickrException { // Use TreeMap so keys are automatically sorted alphabetically Map<String, String> parameters = new TreeMap<String, String>(); parameters.put("method", METHOD_CHECK_TOKEN); parameters.put("oauth_token", authToken); parameters.put(Flickr.API_KEY, apiKey); // This method call must be signed using Flickr (not OAuth) style signing parameters.put("api_sig", getSignature(sharedSecret, parameters)); Response response = transportAPI.getNonOAuth(transportAPI.getPath(), parameters); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Auth auth = constructAuth(response, authToken, tokenSecret); return auth; }
/** * * @param authToken * The authentication token * @param tokenSecret * @return The Auth object * @throws FlickrException * @see "http://www.flickr.com/services/api/flickr.auth.oauth.checkToken.html" */ public Auth checkToken(String authToken, String tokenSecret) throws FlickrException { // Use TreeMap so keys are automatically sorted alphabetically Map<String, String> parameters = new TreeMap<String, String>(); parameters.put("method", METHOD_CHECK_TOKEN); parameters.put("oauth_token", authToken); parameters.put(Flickr.API_KEY, apiKey); // This method call must be signed using Flickr (not OAuth) style signing parameters.put("api_sig", getSignature(sharedSecret, parameters)); Response response = transportAPI.getNonOAuth(transportAPI.getPath(), parameters); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Auth auth = constructAuth(response, authToken, tokenSecret); return auth; }
/** * Exchange an auth token from the old Authentication API, to an OAuth access token. * * Calling this method will delete the auth token used to make the request. * * @param authToken * @throws FlickrException * @see "http://www.flickr.com/services/api/flickr.auth.oauth.getAccessToken.html" */ public Token exchangeAuthToken(String authToken) throws FlickrException { // Use TreeMap so keys are automatically sorted alphabetically Map<String, String> parameters = new TreeMap<String, String>(); parameters.put("method", METHOD_EXCHANGE_TOKEN); parameters.put(Flickr.API_KEY, apiKey); // This method call must be signed using Flickr (not OAuth) style signing parameters.put("api_sig", getSignature(sharedSecret, parameters)); Response response = transportAPI.getNonOAuth(transportAPI.getPath(), parameters); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Token accessToken = constructToken(response); return accessToken; }
/** * Exchange an auth token from the old Authentication API, to an OAuth access token. * * Calling this method will delete the auth token used to make the request. * * @param authToken * @throws FlickrException * @see "http://www.flickr.com/services/api/flickr.auth.oauth.getAccessToken.html" */ public OAuth1RequestToken exchangeAuthToken(String authToken) throws FlickrException { // Use TreeMap so keys are automatically sorted alphabetically Map<String, String> parameters = new TreeMap<String, String>(); parameters.put("method", METHOD_EXCHANGE_TOKEN); parameters.put(Flickr.API_KEY, apiKey); // This method call must be signed using Flickr (not OAuth) style signing parameters.put("api_sig", getSignature(sharedSecret, parameters)); Response response = transportAPI.getNonOAuth(transportAPI.getPath(), parameters); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } OAuth1RequestToken accessToken = constructToken(response); return accessToken; }