com.googlecode.flickrjandroid.auth.Permission Java Examples

The following examples show how to use com.googlecode.flickrjandroid.auth.Permission. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GetRequestToken.java    From glimmr with Apache License 2.0 6 votes vote down vote up
@Override
protected String doInBackground(Void... params) {
    try {
        Flickr f = FlickrHelper.getInstance().getFlickr();

        OAuthToken oauthToken = f.getOAuthInterface().getRequestToken(
                mOAuthCallbackUri.toString());
        saveRequestToken(oauthToken.getOauthTokenSecret());

        URL oauthUrl = f.getOAuthInterface().buildAuthenticationUrl(
                Permission.WRITE, oauthToken);

        return oauthUrl.toString();
    } catch (Exception e) {
        e.printStackTrace();
        mException = e;
    }
    return null;
}
 
Example #2
Source File: OAuthActivity.java    From android-opensource-library-56 with Apache License 2.0 5 votes vote down vote up
private void startOauth() {
    new AsyncTask<Void, Void, String>() {

        @Override
        protected String doInBackground(Void... params) {
            try {
                OAuthInterface oAuthInterface = mFlickr.getOAuthInterface();
                mOAuthToken = oAuthInterface.getRequestToken(null);
                URL oauthUrl = oAuthInterface.buildAuthenticationUrl(
                        Permission.WRITE, mOAuthToken);
                return oauthUrl.toString();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return null;
        }

        @Override
        protected void onPostExecute(String result) {
            if (result != null) {
                Intent intent = new Intent(Intent.ACTION_VIEW,
                        Uri.parse(result));
                startActivity(intent);
            }
        }
    }.execute();
}
 
Example #3
Source File: OAuthInterface.java    From flickr-uploader with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Build the authentication URL using the given permission and frob.
 * 
 * The hostname used here is www.flickr.com. It differs from the api-default api.flickr.com.
 * 
 * @param permission
 *            The Permission
 * @param frob
 *            The frob returned from getFrob()
 * @return The URL
 * @throws MalformedURLException
 */
public URL buildAuthenticationUrl(Permission permission, OAuthToken oauthToken) throws MalformedURLException {
	List<Parameter> parameters = new ArrayList<Parameter>();
	parameters.add(new Parameter(PARAM_OAUTH_TOKEN, oauthToken.getOauthToken()));
	if (permission != null) {
		parameters.add(new Parameter("perms", permission.toString()));
	}

	int port = oauthTransport.getPort();
	String path = "/services/oauth/authorize";

	return UrlUtilities.buildUrl(Flickr.DEFAULT_API_HOST, port, path, parameters);
}