Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package ru.hh.oauth.subscribe.apis;
 

Author(s):
Boris G. Tsirkin <mail@dotbg.name>
Since:
20.4.2011
public class VkontakteApi extends DefaultApi20 {
    private static final String AUTHORIZE_URL = "https://oauth.vk.com/authorize?client_id=%s&redirect_uri=%s&response_type=code";
    private static final String SCOPED_AUTHORIZE_URL = String.format("%s&scope=%%s");
    @Override
    public String getAccessTokenEndpoint() {
        return "https://oauth.vk.com/access_token";
    }
    @Override
    public String getAuthorizationUrl(final OAuthConfig config) {
        Preconditions.checkValidUrl(config.getCallback(), "Valid url is required for a callback. Vkontakte does not support OOB");
        if (config.hasScope()) { // Appending scope if present
            return String.format(
                    config.getApiKey(), OAuthEncoder.encode(config.getCallback()), OAuthEncoder.encode(config.getScope()));
        } else {
            return String.format(config.getApiKey(), OAuthEncoder.encode(config.getCallback()));
        }
    }
    @Override
        return new JsonTokenExtractor();
    }
New to GrepCode? Check out our FAQ X