IN.Auth, IN.Event, and IN.UI

JavaScript SDK

The User Object

Allows manipulation of the User Object, such as authorizing, logging out, or refreshing the user's session. 

Check if the User Is Authorized

You can use the isAuthorized method to see if the user has granted access to your application.


It returns a boolean true if the user is authorized, otherwise it returns false.

Request Authorization

You can request additional privileges by requiring the user to authorize. It's recommended to call this method in response to a user action to avoid popup blockers. If the user is not logged in, it will present the popup authorization window.

IN.User.authorize(callbackFunction, callbackScope)
  • callbackFunction - Function
    a function to call when the user is authorized. If the user is already logged in, callbackFunction will fire immediately
  • callbackScope - Object
    an optional scope to run callbackFunction in. Defaults to the window scope

Log the User Out

You can log the user out of your application using the following code. In the JavaScript SDK, logging the user out is defined as logging them out of the LinkedIn network (i.e. clearing cookies). This does not revoke or delete the user's authorization grant for your application.

IN.User.logout(callbackFunction, callbackScope)
  • callbackFunction - Function
    a function to call when the user is logged out.
  • callbackScope - Object
    an optional scope to run callbackFunction in. Defaults to the window scope

Refresh the User Session

The default user session is 30 minutes (after which the OAuth token expires). If you want to be sure the user is authorized and that your environment has a valid OAuth token, you can request a refresh of the user's session:


This will refresh their token for an additional 30 minutes. This call shouldn't be used to keep the user perpetually logged in, since that can introduce a security hole.

Authorization Tokens

While the easiest method of authenticating a user for the JS SDK is to use one of the login buttons, some sites have implemented the OAuth 1.0a flow used by the REST API.  Whichever type of authentication you use for the user, the JS SDK will recognize that the member has already logged in, as long as the key and hostname are the same. This happens automatically, requiring no additional code by the developer.

If a user has logged in using the JS SDK, a permanent token for the REST APIs can be generated from the JS SDK token. Details on this process are at here.

Parsing Tags

As the framework loads, it will automatically scan the document and render any LinkedIn-specific tags. Occasionally, you may dynamically change the contents of the DOM and new LinkedIn tags need to be parsed. If the platform has already loaded, you can re-parse for new IN tags with the following JavaScript:


Where domNode is the node whose contents should be parsed (e.g. use document.body to trigger a re-parse of the entire page).


Events provide a way for the developer to hook into interesting moments within the JavaScript SDK. These include user session state changes, as well as when the framework is loaded. All events are subscribed to through the same universal Event API:

IN.Event.on(IN, eventName, callback, callbackScope, extraData)
IN.Event.onOnce(IN, eventName, callback, callbackScope, extraData)

Invoking onOnce will limit the event's callback to happening a single time.

  • IN
    This is the global IN object, the root namespace of the LinkedIn JavaScript SDK. This means you want to listen to the framework's global events. In the future, it may be possible to subscribe to events from specific components.
  • eventName - String
    This is the name of the event. Supported events are:

    auth - The user has authorized this application

    frameworkLoaded - Fires before systemReady when all foundation JavaScript has been loaded from Usage for this event is intended to be internal-only for now.

    logout - The user has logged out of the application

    systemReady - Fired with the system is completely ready for execution. onLoad events can fire.
  • callback - Function
    A callback function to execute when eventName fires
  • callbackScope - Object
    An optional scope to execute callback in. If not set, will default to the window scope
  • extraData - Object
    Provide an additional object to callback. If not set, will default to {}

Invoking UI Objects Directly

The UI elements can be invoked directly to open windows for the user to interact with LinkedIn. Many of these UI elements are spawned by either User actions or IN Tags. It's recommended that, to avoid popup blockers, all UI calls be in response to a user action such as clicking on an element.

All UI elements have the following methods:

  • params()
    Takes a key/value object definition that serves as parameterization for the widget.
  • place(domNode)
    Creates the UI element and inserts it into the document at the specific domNode. If domNode isn't specified, document.body is used
  • place(relative, domNode)
    Place the UI element relative to domNode.  Valid values for relative are "in", "before", and "after"


Opens an authorization window.



Opens a LinkedIn Share window so that the current member can share a URL with his professional network:

  url: ""
  • url - String
    The url to share with LinkedIn Members

Async Loading

To avoid encountering race conditions in your page, you can load the framework asynchronously.

If your page uses JQuery, the following code will work:

$(document).ready(function() {
    $.getScript("", function success() {
            onLoad: "myOnloadFunction"

Otherwise, you need something like this:

<script type="text/javascript" src=""></script>
<script type="text/javascript">
        onLoad: "myOnloadFunction"
        // any other parameters you'd normally put beneath the script element would be here