flutter_linkedin_login 2.4.0 copy "flutter_linkedin_login: ^2.4.0" to clipboard
flutter_linkedin_login: ^2.4.0 copied to clipboard

discontinued

A Flutter plugin for allowing users to authenticate with LinkedIn and getting the user's basic profile

flutter_linkedin_login #

A Flutter plugin for Sign in with LinkedIn

IMPORTANT NOTICE #

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]

Installation #

See the installation instructions on pub

Android #

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);
}

iOS #

  • May not work with iOS 12

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;
}

Usage #

See the example

Methods #

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"

Widgets #

Widget Description Render
LinkedInSignInButton Button that calls loginBasicWithProfile(). To get the profile, pass in argument onSignIn: (profile, ex){...} Sign In with LinkedIn

LinkedInProfile #

  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;

Additional API calls #

Submit an issue if you would like to see additional LinkedIn APIs exposed. This simple implementation was enough for my purposes.

0
likes
40
pub points
52%
popularity

Publisher

unverified uploader

A Flutter plugin for allowing users to authenticate with LinkedIn and getting the user's basic profile

Repository (GitHub)
View/report issues

License

BSD-2-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_linkedin_login