Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Social network with id = FACEBOOK already exists #9

Closed
MoliByte opened this issue Sep 25, 2017 · 4 comments
Closed

Social network with id = FACEBOOK already exists #9

MoliByte opened this issue Sep 25, 2017 · 4 comments

Comments

@MoliByte
Copy link

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?

@maksim88
Copy link
Owner

This exception is only thrown when you call addSocialNetwork() and the network already exists.
Are you sure that you did not call addSocialNetwork() before the snippet you posted?

@hynra
Copy link

hynra commented Oct 18, 2017

try this :

ArrayList<String> connectedNetwork = new ArrayList<>();
for (SocialNetwork socialNetwork : easyLogin.getInitializedSocialNetworks()) {
  Log.i("Social Login", socialNetwork.getNetwork().name());
  connectedNetwork.add(socialNetwork.getNetwork().name());
}
        
if(!connectedNetwork.contains("FACEBOOK"))
  easyLogin.addSocialNetwork(new FacebookNetwork(this, fbScope));
if(!connectedNetwork.contains("GOOGLE_PLUS"))
  easyLogin.addSocialNetwork(new GooglePlusNetwork(this));

@MoliByte
Copy link
Author

@maksim88 this error occurs when i click login button second times ,it happens

@MoliByte
Copy link
Author

@hynra here is a solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants