Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including nativescript-linkedin-signin with all npm packages installed. Try it out:

var nativescriptLinkedinSignin = require("nativescript-linkedin-signin")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

nativescript-linkedin-signin v1.0.2

NativeScript Linkedin Auth plugin

Nativescript LinkedIn Auth

npm version

NativeScript plugin for LinkedIn Auth. Use OAuth2 to sign in with LinkedIn. Use this iOS lib and this Android lib.

Installation

Add the plugin

tns plugin add nativescript-linkedin-signin

Android

Add this line into the AndroidManifest.xml

<activity android:name="com.teammobile.linkedinsignin.ui.LinkedinSignInActivity"/>

Usage

    import { Component, OnInit } from "@angular/core";
    import { LinkedinSignin } from "nativescript-linkedin-signin";
    import * as Application from "tns-core-modules/application";
    import * as utilsModule from "tns-core-modules/utils/utils";
    import { isAndroid } from "tns-core-modules/platform/platform";


    @Component({
        selector: "Home",
        templateUrl: "./home.component.html"
    })
    export class HomeComponent implements OnInit {

        constructor() {
        }

        ngOnInit(): void {
            // Init your component properties here.
            if(isAndroid){
                LinkedinSignin.init("<CLIENT_ID>", "<CLIENT_SECRET>", "<REDIRECT_URI>", new Array<string>(), utilsModule.ad.getApplicationContext());
            } else {
                LinkedinSignin.init("<CLIENT_ID>", "<CLIENT_SECRET>", "<REDIRECT_URI>", new Array<string>(), Application.ios.rootController);
            }
        }

        coLinkedin(): void {
            LinkedinSignin.login().then(item => {
                console.dir(item);
                alert(item.token.accessToken);
            }).catch((error)=>{
                alert("FAIL : "+error.error);
                console.dir(error);
            });
        }
    }

License

Apache License Version 2.0, January 2004

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free