A Flutter plugin for Sign in with LinkedIn
LinkedIn is discontinuing their mobile SDKs, which this plugin depends on. iOS 12 seems to already be not working anymore. The LinkedIn app, doesn't ask for 3rd party app permissions like it used to. Support will end March 2019. The fate of this plugin is undetermined. It may be redesigned to use LinkedIn's OAuth 2.0 APIs. Stay tuned. See [https://engineering.linkedin.com/blog/2018/12/developer-program-updates]
See the installation instructions on pub
Follow the "Associate your Android app with your LinkedIn app" section of LinkedIn's Getting started with Android. Find your package name in the android/app/src/main/AndroidManifest.xml file. For the debug key hash value generation, remember to use 'android' as your password. Click update after adding your package and key in LinkedIn's developer console for your changes to take.
Open your MainActivity in your Android app/src/main/ directory and override the onActivityResult method with the following
import android.content.Intent
import io.tuantvu.flutterlinkedinlogin.FlutterLinkedinLoginPlugin
//kotlin
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
FlutterLinkedinLoginPlugin.onActivityResult(this, requestCode, resultCode, data)
super.onActivityResult(requestCode, resultCode, data)
}
import android.content.Intent
import io.tuantvu.flutterlinkedinlogin.FlutterLinkedinLoginPlugin
//java
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
FlutterLinkedinLoginPlugin.onActivityResult(this, requestCode, resultCode, data);
super.onActivityResult(requestCode, resultCode, data);
}
Follow the "Associate your iOS app with your LinkedIn app" section of LinkedIn's Getting started with iOS.
Open your AppDelegate in your ios/Runner directory and add the following function
//swift
//add #import <flutter_linkedin_login/FlutterLinkedinLoginPlugin.h>
//to your Running-Bridging-Header.h file
override func application(_ app: UIApplication, open: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
if (FlutterLinkedinLoginPlugin.shouldHandle(open)) {
return FlutterLinkedinLoginPlugin.application(app, open: open, sourceApplication: nil, annotation: nil)
}
return true
}
//objective-c
//add #import <flutter_linkedin_login/FlutterLinkedinLoginPlugin.h> at top of your AppDelegate.m
- (BOOL)application:(UIApplication *)application open:(NSURL *)open options:(UIApplicationOpenURLOptionsKey *)options {
if ([FlutterLinkedinLoginPlugin shouldHandleUrl:url]) {
return [FlutterLinkedinLoginPlugin application:application open:open sourceApplication:nil annotation: nil];
}
return YES;
}
See the example
Method | Description | Returns |
---|---|---|
loginBasic() | Log in with basic profile | "Logged in" or "Access token still valid" |
getProfile() | Retrieves profile with whatever permissions were asked for during log in | LinkedInProfile |
loginBasicWithProfile() | Convenience method that logs in with basic profile and returns the profile | LinkedInProfile |
accessToken() | Returns current access token | LinkedInAccessToken |
logout() | Logs out | "Cleared session" or "No session" |
Widget | Description | Render |
---|---|---|
LinkedInSignInButton | Button that calls loginBasicWithProfile(). To get the profile, pass in argument onSignIn: (profile, ex){...} | ![]() |
String firstName;
String lastName;
String headline;
String id;
String pictureUrl;
String summary;
String industry;
String emailAddress;
String formattedName;
LinkedInLocation location;
List<LinkedInPosition> positions;
String publicProfileUrl;
Submit an issue if you would like to see additional LinkedIn APIs exposed. This simple implementation was enough for my purposes.
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.
example/README.md
Demonstrates how to use the flutter_linkedin_login plugin.
For help getting started with Flutter, view our online documentation.
Add this to your package's pubspec.yaml file:
dependencies:
flutter_linkedin_login: ^2.4.0
You can install packages from the command line:
with Flutter:
$ flutter packages get
Alternatively, your editor might support flutter packages get
.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:flutter_linkedin_login/flutter_linkedin_login.dart';
Version | Uploaded | Documentation | Archive |
---|---|---|---|
2.4.0 | Dec 17, 2018 |
|
|
2.3.0 | Dec 15, 2018 |
|
|
2.2.1 | Dec 14, 2018 |
|
|
2.2.0 | Dec 11, 2018 |
|
|
2.1.0 | Sep 10, 2018 |
|
|
2.0.0 | Sep 9, 2018 |
|
|
1.0.0 | Jul 22, 2018 |
|
|
Popularity:
Describes how popular the package is relative to other packages.
[more]
|
70
|
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]
|
85
|
We analyzed this package on Feb 14, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: Flutter
References Flutter, and has no conflicting libraries.
Document public APIs. (-0.37 points)
91 out of 93 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.
Format lib/flutter_linkedin_login.dart
.
Run flutter format
to format lib/flutter_linkedin_login.dart
.
Format lib/linkedin_signin_button.dart
.
Run flutter format
to format lib/linkedin_signin_button.dart
.
Package | Constraint | Resolved | Available |
---|---|---|---|
Direct dependencies | |||
Dart SDK | >=1.20.1 <3.0.0 | ||
flutter | 0.0.0 | ||
Transitive dependencies | |||
collection | 1.14.11 | ||
meta | 1.1.6 | 1.1.7 | |
sky_engine | 0.0.99 | ||
typed_data | 1.1.6 | ||
vector_math | 2.0.8 |