
Security News
Security Community Slams MIT-linked Report Claiming AI Powers 80% of Ransomware
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.
@huyhpham/rn-line
Advanced tools

Line SDK wrapper for React Native 🚀
This library includes:
>=0.61.1minSdkVersion set to 17 or higherIf you are currently using react-native-line-sdk (v1.x.x):
  react-native unlink react-native-line-sdk
package.json*.aar from android/libsandroid/app/build.gradle:repositories {
    flatDir {
        dirs 'libs'
    }
}
Finally, follow the installation steps for the new version.
First, install the npm package with yarn. Autolink is automatic.
  yarn add @xmartlabs/react-native-line
Inside your AppDelegate.m, setup the line sdk by passing the channel id obtained.
platform :ios, '10.0' in Podfile line:1AppDelegate.m to match the following:// AppDelegate.m
//
// Import the Library
//
@import RNLine;
//
// Setup the plugin using your CHANNEL_ID when the app finishes launching
//
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [LineLogin setupWithChannelID:@"YOUR_CHANNEL_ID" universalLinkURL:nil];
}
//
// Handle redirection back to the app from Line
//
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
  return [LineLogin application:app open:url options:options];
}
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler
{
  BOOL handledLine = [LineLogin application:application continue:userActivity restorationHandler:restorationHandler];
  return handledLine;
}
AppDelegate.m to match the following:// AppDelegate.swift
//
// Import the Library
//
import LineLogin
//
// Setup the plugin using your CHANNEL_ID when the app finishes launching
//
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    LineLogin.setup(channelID: "YOUR_CHANNEL_ID", universalLinkURL: nil)
    return true
}
//
// Handle redirection back to the app from Line
//
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
    return LineLogin.application(app, open: url, options: options)
}
Don't forget to add application function, as line's instructions indicate.
line_channel_id to your strings file with the the channel id that you have on your line console.<string name="line_channel_id" translatable="false">Your channel id here</string>
minSdkVersion = 17 in android/build.gradleandroid/build.gradleandroid {
  // Enable Java 1.8 support.
  compileOptions { // <- add this block if didn't setup
      sourceCompatibility JavaVersion.VERSION_1_8
      targetCompatibility JavaVersion.VERSION_1_8
  }
  ...
  dependencies {
    ...
    implementation 'com.linecorp.linesdk:linesdk:5.7.0' // <- add this line
  }
}
xmlns:tools="http://schemas.android.com/tools" in your manifest tag and also tools:replace="android:allowBackup" in your application tagFirst, require the LineLogin module:
import LineLogin from '@xmartlabs/react-native-line'
Then, you can start using all the functions that are available:
| Function | Description | 
|---|---|
| login(args?: LoginArguments): Promise<LoginResult> | Starts the login flow of Line's SDK (Opens the apps if it's installed and defaults to the browser otherwise). It accepts the same argumements as the LineSDK, in an object { key: value }, defaults the same way as LineSDK too. | 
| getCurrentAccessToken(): Promise<AccessToken> | Returns the current access token for the currently logged in user. | 
| getProfile(): Promise<UserProfile> | Returns the profile of the currently logged in user. | 
| logout(): Promise<void> | Logs out the currently logged in user. | 
| refreshToken(): Promise<AccessToken> | Refreshes the access token and returns it. | 
| verifyAccessToken(): Promise<AccessTokenVerifyResult> | Verifies the access token and returns it. | 
| getBotFriendshipStatus(): Promise<BotFriendshipStatus> | Gets bot friendship status if configured. | 
The following objects are returned on the methods described above:
{
   /// The user ID of the current authorized user.
  userID: String
  /// The display name of the current authorized user.
  displayName: string
  /// The profile image URL of the current authorized user. `null` if the user has not set a profile
  /// image.
  pictureURL?: string
  /// The status message of the current authorized user. `null` if the user has not set a status message.
  statusMessage?: string
}
{
   /// The value of the access token.
  access_token: String
  /// The expiration time of the access token. It is calculated using `createdAt` and the validity period
  /// of the access token. This value might not be the actual expiration time because this value depends
  /// on the system time of the device when `createdAt` is determined.
  expires_in: String
  /// The raw string value of the ID token bound to the access token. The value exists only if the access token
  /// is obtained with the `.openID` permission.
  id_token?: String
}
{
  // The channel ID bound to the access token.
  client_id: String
  /// The amount of time until the access token expires.
  expires_in: String
  /// Valid permissions of the access token separated by spaces
  scope: String
}
{
   /// The access token obtained by the login process.
  accessToken: AccessToken
  /// The permissions bound to the `accessToken` object by the authorization process. Scope has them separated by spaces
  scope: String
  /// Contains the user profile including the user ID, display name, and so on. The value exists only when the
  /// `.profile` permission is set in the authorization request.
  userProfile?: UserProfile
  /// Indicates that the friendship status between the user and the bot changed during the login. This value is
  /// non-`null` only if the `.botPromptNormal` or `.botPromptAggressive` are specified as part of the
  /// `LoginManagerOption` object when the user logs in. For more information, see Linking a bot with your LINE
  /// Login channel at https://developers.line.me/en/docs/line-login/web/link-a-bot/.
  friendshipStatusChanged?: boolean
  /// The `nonce` value when requesting ID Token during login process. Use this value as a parameter when you
  /// verify the ID Token against the LINE server. This value is `null` if `.openID` permission is not requested.
  IDTokenNonce?: String
}
{
  friendFlag: boolean
}
{
  scopes?: LoginPermission[]
  onlyWebLogin?: boolean
  botPrompt?: BotPrompt
}
{
  EMAIL = 'email',
  /// The permission to get an ID token in the login response.
  OPEN_ID = 'openid',
  /// The permission to get the user's profile including the user ID, display name, and the profile image
  /// URL in the login response.
  PROFILE = 'profile',
}
{
  aggressive = 'aggressive',
  normal = 'normal',
}
    try {
        ...
        const loginResult = await Line.login()
        ...
    } catch (error) {
        ...
    }
    try {
        ...
        const loginResult = await Line.login({
          scopes: ['email', 'profile'],
          botPrompt: 'normal'
        })
        ...
    } catch (error) {
        ...
    }
    try {
        ...
        const profile = await Line.getProfile()
        ...
    } catch (error) {
        ...
    }
    try {
        ...
        await Line.logout()
        ...
    } catch (error) {
        ...
    }
If you want to see @xmartlabs/react-native-line in action, just move into the example folder and run yarn ios/yarn android. By seeing its source code, you will have a better understanding of the library usage.
| Emiliano Botti đź’» | JoaquĂn Aguirre đź’» | Nicolas Hernandez đź’» đź‘€ | Santiago Fernández 📆 👀💻 | MatĂas Irland đź‘€ | 
@xmartlabs/react-native-line is available under the MIT license. See the LICENCE file for more info.
FAQs
React Native Line wrapper
We found that @huyhpham/rn-line demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.

Research
/Security News
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.