linkedin_login 2.2.2-beta.1 icon indicating copy to clipboard operation
linkedin_login: ^2.2.2-beta.1 copied to clipboard


Library for login with LinkedIn OAuth V2 service. This library helps you to implement authorization with LinkedIn OAuth API's.

linkedin_login #

Codacy Badge codecov

  • A Flutter library for LinkedIn OAuth 2.0 APIs .
  • This library is using authorization from LinkedIn API

⭐⭐⭐⭐ Star ⭐⭐⭐⭐ a repo if you like project. Your support matters to us.⭐⭐⭐⭐

Installation #

Important #

You should replace this values

final String redirectUrl = 'YOUR-REDIRECT-URL';
final String clientId = 'YOUR-CLIENT-ID';
final String clientSecret = 'YOUR-CLIENT-SECRET';

Note: clientSecret field is required just for LinkedInUserWidget

Hybrid Composition vs Virtual displays (Android only) #

To get these values you need to create App on the LinkedIn.

  • Please check your minSdkVersion for different setup: -- If you are using Hybrid Composition (default from version 2.1.0) your minSdkVersion should be at least 19 -- If you want to use Virtual displays (default before version 2.1.0) your minSdkVersion should be at least 20

To read more why this lib needs to use one of these two modes please visit docs of webview_flutter

Samples #

You can see full example under this project.

Call LinkedIn authorization and get user object:

       redirectUrl: redirectUrl,
       clientId: clientId,
       clientSecret: clientSecret,
           (UserSucceededAction linkedInUser) {
                print('Access token ${linkedInUser.user.token.accessToken}');
                print('First name: ${linkedInUser.user.firstName.localized.label}');
                print('Last name: ${linkedInUser.user.lastName.localized.label}');
       onError: (UserFailedAction e) {
                print('Error: ${e.toString()}');

Or you can just fetch authorization code (clientSecret is not required in this widget):

        redirectUrl: redirectUrl,
        clientId: clientId,
            (AuthorizationSucceededAction response) {
                print('Auth code ${response.codeResponse.code}');
                print('State: ${response.codeResponse.state}');
        onError: (AuthorizationFailedAction e) {
                print('Error: ${e.toString()}');

If you want to logout user (to clear session from webview) all you need is to forward true value to property destroySession in LinkedInUserWidget or LinkedInAuthCodeWidget. Please don't forget to destroy your data in your local storage for this user. Currently, LinkedIn doesn't have API point on OAuth 2 which will destroy access token.

Properties that are available after call for LinkedInUserWidget #

  String firstName;
  String lastName;
  String accessToken;
  int expiresIn;
  String profilePicture;
  String email;
  String userId; (from version 0.1.)

Projection - which properties of user account will be accessible via LinkedIn API #

Available from version 1.2.x #

You can control projection, by providing array of strings to projection property of widget LinkedInUserWidget. By default these properties are included:

  static const String id = "id";
  static const String localizedLastName = "localizedLastName";
  static const String firstName = "firstName";
  static const String lastName = "lastName";
  static const String localizedFirstName = "localizedFirstName";

You can include also profilePicture to get URL of user profile image. If you change this property to some custom value you will override default values, and you need to add every of these manually to array. For more info see example project.

Properties that are available after call for LinkedInAuthCodeWidget #

  String code; // authorization code
  String state;

Widgets #

Standard LinkedIn button for login. This widget is modifiable.

LinkedInButtonStandardWidget(onTap: () {});

Contribution #

  • To regenerate mocks and generated files please run:
flutter packages pub run build_runner build --delete-conflicting-outputs

Known Limitations #

  • Best and shortest explanation why library is not supporting this is hidden behind this (comment)[]
  • If you have (access)[] to (developer partner program)[] I would really appreciate if you could submit pull request on this feature.


  • As Firebase is not supporting LinkedIn out of the box this is not implemented inside the library and its heavy consuming time to implement custom solution, anyhow if someone is willing to submit PR I would really love to approve it


  • Web is still not supported at it requires a lot of JS work, as LinkedIn doesn't allow that their API is injected into iFrame
pub points


unverified uploader

Library for login with LinkedIn OAuth V2 service. This library helps you to implement authorization with LinkedIn OAuth API's.

Repository (GitHub)


API reference


Icon for licenses.MIT (LICENSE)


flutter, http, meta, rxdart, uuid, webview_flutter, webview_flutter_android, webview_flutter_wkwebview


Packages that depend on linkedin_login