phi-jp / cordova-plugin-sso

cordova-plugin-sso
3 stars 3 forks source link

example #3

Open shi11 opened 6 years ago

shi11 commented 6 years ago

hi there, great potential here.

I'm building an example app to test SSO login. So far, I'm having some trouble getting Facebook and Twitter to work. Does it work for you? Can you share what params you are passing into each platform? thanks in advance. Seth

snuffy commented 5 years ago

@shi11

Hello! Thank you for your interest in our plugin

There are bugs in previous versions, each SDK (Twitter FB LINE) is old, and it conflicts with many plugins.

We solve this problem by using CocoaPod, this plugin is lightweight and will not conflict with other plugins. Many bugs were fixed in version 0.2.0.

Please try this plugin again! Example

$ cordova plguin add cordova-plugin-sso --variable TWITTER_KEY=XXXX --variable TWITTER_SECRET=XXXX

or adding below code to config.xml

<plugin name="cordova-plugin-sso" spec="0.2.0">
    <variable name="TWITTER_KEY" value=XXXX />
    <variable name="TWITTER_SECRET" value=XXXX />
    <variable name="FACEBOOK_APP_ID" value=[Facebook app id] />
    <variable name="FACEBOOK_APP_NAME" value=[Facebook app name] />
</plugin>

Twitter login

if (window.sso) {
  sso.twitter.login(function(res) {
    // success callback function
    // res is user profile.
  });

  sso.facebook.login(function(res) {
    // success callback function
    // res is user profile.
  });
}

Thanks