linkedin_login 0.2.0

linkedin_login #

  • A Flutter library for LinkedIn OAuth 2.0 APIs .

  • This library is using new way of authorization on LinkedIn

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

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

Samples #

You can see full example under this project.

Call LinkedIn authorization and get user object:

    LinkedInUserWidget(
       redirectUrl: redirectUrl,
       clientId: clientId,
       clientSecret: clientSecret,
       onGetUserProfile:
           (LinkedInUserModel linkedInUser) {
                print('Access token ${linkedInUser.token.accessToken}');
                print('First name: ${linkedInUser.firstName.localized.label}');
                print('Last name: ${linkedInUser.lastName.localized.label}');
       },
       catchError: (LinkedInErrorObject error) {
         print(
             'Error description: ${error.description},'
             ' Error code: ${error.statusCode.toString()}');
        },
    )

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

    LinkedInAuthCodeWidget(
        redirectUrl: redirectUrl,
        clientId: clientId,
        onGetAuthCode:
            (AuthorizationCodeResponse response) {
                print('Auth code ${response.code}');
                print('State: ${response.state}');
            },
    ),

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.)

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: () {});

Changelog #

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

v0.1.0 - 2019-01-23 #

Added #

  • Login with LinkedIn support to Android and IOS using pure dart
  • LinkedIn default button
  • Retrieve basic user information from linked login with email and token

v0.1.1 - 2019-04-03 #

Version upgrade #

  • Upgrade version of libraries that this package is using

v0.1.3 - 2019-05-03 #

Added new field into user model #

  • UserId in LinkedInUserModel class
  • Fix bugs if there is not existing images

v0.1.4 - 2019-05-30 #

Added new widget #

  • Fetch just authorization code
  • Use widget without sending client secret code

v0.1.6 - 2019-07-5 #

Added new widget #

  • Add possibility to add app bar into webview as parameter

v0.1.7 - 2019-08-5 #

Added new widget #

  • It can be case that URL route from redirect is redirecting to some other field
  • in that case you can use property "frontendRedirectUrl" so that you still can use redirect URL
  • of LinkedIn, but also handle if frontend redirect that link to some other site

v0.1.8 - 2019-08-5 #

Added new widget #

  • Expose frontendRedirectUrl field

v0.2.0 - 2019-08-12 #

Added new widget #

  • Possibility to log out user from linkedIn - from now you can change account as should

example/README.md

example #

Example for usage of linkedin_login library

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  linkedin_login: ^0.2.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:linkedin_login/linkedin_login.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
80
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
90
Learn more about scoring.

We analyzed this package on Aug 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
flutter_webview_plugin ^0.3.5 0.3.7
http ^0.12.0 0.12.0+2
uuid ^2.0.1 2.0.2
Transitive dependencies
async 2.3.0
charcode 1.1.2
collection 1.14.11 1.14.12
convert 2.1.1
crypto 2.1.2
http_parser 3.1.3
meta 1.1.6 1.1.7
path 1.6.4
pedantic 1.8.0+1
sky_engine 0.0.99
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test