Skip to content

Instantly share code, notes, and snippets.

@ftp27
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ftp27/c9db152488ec0b012daf to your computer and use it in GitHub Desktop.
Save ftp27/c9db152488ec0b012daf to your computer and use it in GitHub Desktop.
package com.codename1.social;
import com.codename1.io.Oauth2;
import com.codename1.social.Login;
import java.util.Hashtable;
public class VkontakteConnect extends Login{
private static String scope = "email";
private static String tokenURL = "https://oauth.vk.com/access_token";
private static VkontakteConnect instance;
static Class implClass;
VkontakteConnect() {
setOauth2URL("https://oauth.vk.com/authorize");
}
/**
* Gets the VkontakteConnect singleton instance
* .
* @return the VkontakteConnect instance
*/
public static VkontakteConnect getInstance() {
if (instance == null) {
if (implClass != null) {
try {
instance = (VkontakteConnect) implClass.newInstance();
} catch (Throwable t) {
instance = new VkontakteConnect();
}
} else {
instance = new VkontakteConnect();
}
}
return instance;
}
@Override
public boolean isNativeLoginSupported() {
return false;
}
@Override
protected Oauth2 createOauth2() {
Hashtable params = new Hashtable();
params.put("v", "5.34");
params.put("display", "mobile");
Oauth2 auth = new Oauth2(oauth2URL, clientId, redirectURI, scope, tokenURL, clientSecret, params);
return auth;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment