Last active
August 29, 2015 14:25
-
-
Save ftp27/c9db152488ec0b012daf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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