Wednesday, 20 April 2016

Linkedin Login in your Ionic App

The simple way for Linkedin login in your Ionic App has five step.

1) Go to your project folder in Command Prompt

        cd "projects/ionic/LinkedinLoginApp"

2) Install cordova oauth plugin in your app

        cordova plugin add https://github.com/oauth-io/oauth-phonegap

3) Install inApp browser plugin
cordova plugin add cordova-plugin-inappbrowser

4) Create an App in your Linked in developer console

Create: "Client ID" & " Client Secret "
Set the app's callback URL to https://oauth.io/auth

4) Create an account in https://oauth.io/ and go to "Integrated APIs"

Add APIs> search for linkedin
Give your "Client ID" & "Client Secret"
Click "Try Auth" you will get an "Application id"

5) On your Login function

OAuth.initialize("Application id");
      OAuth.popup('linkedin').done(function(result) {
                    // do some stuff with result
                  result.me().done(function(data) {
                      // do something with `data`, e.g. print data.name
                      })
      })