maksim88 / easylogin Goto Github PK
View Code? Open in Web Editor NEWLogin effortlessly with different social networks like Facebook, Twitter or Google Plus
License: MIT License
Login effortlessly with different social networks like Facebook, Twitter or Google Plus
License: MIT License
EasyLogin.initialize();
easyLogin = EasyLogin.getInstance();
List fbScope = Arrays.asList("public_profile", "email");
// error occurs on this line
easyLogin.addSocialNetwork(new FacebookNetwork(this, fbScope));
What should I do to avoid this Exception?
Looks like its almost identical to ASNE. Why didnt you create a fork of this one?
The global access token method has only name email and id set.But for sign in purpose,including the profile picture uri is necessary ,and i cant find any way of manually doing that as the SignInResult object is not available.
I only need google login, but when i starting activity this hava a exception witg facebook api, how to remove this?
Can this work in class which extends Fragment
public class PageLoginFragment extends Fragment implements OnLoginCompleteListener {
}
This not work, can you give example of class?
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
EasyLogin.initialize();
mEasyLogin = EasyLogin.getInstance();
View view = inflater.inflate(R.layout.page_login_fragment, container, false);
// FACEBOOK
fbScope = new ArrayList<>();
fbScope.addAll(Collections.singletonList("public_profile, email"));
mEasyLogin.addSocialNetwork(new FacebookNetwork(getActivity(), fbScope));
facebook = (FacebookNetwork) mEasyLogin.getSocialNetwork(SocialNetwork.Network.FACEBOOK);
facebook.setOnLoginCompleteListener(this);
loginButton = (LoginButton) view.findViewById(R.id.login_button);
// Call this method if you are using the LoginButton provided by facebook
// It can handle its own state
if (!facebook.isConnected()) {
facebook.requestLogin(loginButton,this);
}
updateStatuses();
return view;
}
But never call event onError or onLoginSuccess
Hi,
When I click on login button on Google plus nothing happen. Do you know what is wrong
public class PageLoginFragment extends Fragment implements OnLoginCompleteListener {
private View view;
private EasyLogin mEasyLogin;
ArrayList<String> fbScope;
private LoginButton loginButton;
private SignInButton gPlusButton;
FacebookNetwork facebook;
GooglePlusNetwork gPlusNetwork;
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
mEasyLogin.onActivityResult(requestCode, resultCode, data);
}
@Override
public void onLoginSuccess(SocialNetwork.Network network) {
if (network == SocialNetwork.Network.FACEBOOK) {
AccessToken token = mEasyLogin.getSocialNetwork(SocialNetwork.Network.FACEBOOK).getAccessToken();
String fbtok = token.getToken();
System.out.println(fbtok);
}else if (network == SocialNetwork.Network.GOOGLE_PLUS) {
AccessToken token = mEasyLogin.getSocialNetwork(SocialNetwork.Network.GOOGLE_PLUS).getAccessToken();
String gptok = token.getToken();
System.out.println(gptok);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
EasyLogin.initialize();
mEasyLogin = EasyLogin.getInstance();
view = inflater.inflate(R.layout.page_login_fragment, container, false);
// FACEBOOK
fbScope = new ArrayList<>();
fbScope.addAll(Collections.singletonList("public_profile, email"));
mEasyLogin.addSocialNetwork(new FacebookNetwork((MainActivity)getActivity(), fbScope));
facebook = (FacebookNetwork) mEasyLogin.getSocialNetwork(SocialNetwork.Network.FACEBOOK);
facebook.setOnLoginCompleteListener(this);
loginButton = (LoginButton) view.findViewById(R.id.login_button);
// Call this method if you are using the LoginButton provided by facebook
// It can handle its own state
if (!facebook.isConnected()) {
facebook.requestLogin(loginButton,this);
}
mEasyLogin.addSocialNetwork(new GooglePlusNetwork((MainActivity)getActivity()));
gPlusNetwork = (GooglePlusNetwork) mEasyLogin.getSocialNetwork(SocialNetwork.Network.GOOGLE_PLUS);
gPlusNetwork.setOnLoginCompleteListener(this);
gPlusButton = (SignInButton) view.findViewById(R.id.gplus_sign_in_button);
gPlusButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!gPlusNetwork.isConnected()) {
gPlusNetwork.requestLogin(PageLoginFragment.this);
}
}
});
updateStatuses();
return view;
}
private void updateStatuses() {
StringBuilder content = new StringBuilder();
for (SocialNetwork socialNetwork : mEasyLogin.getInitializedSocialNetworks()) {
content.append(socialNetwork.getNetwork())
.append(": ")
.append(socialNetwork.isConnected())
.append("\n");
}
System.out.println(content.toString());
}
@Override
public void onError(SocialNetwork.Network socialNetwork, String requestID, String errorMessage) {
Log.e("MAIN", "ERROR!" + socialNetwork + "|||" + errorMessage);
}
}
It could be valuable to just include the social networks you really need into the project
(although proguard strips off unneeded methods)
--> Modularize dependencies
Hello Mak,
I want to use my own custom made button. how i can use without using your social button. if there is not option at least how i can update the text in your button.
When I try it add to project, I have got Error
Error:Failed to resolve: com.twitter.sdk.android:twitter:2.3.2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.