npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

expo-line-authentication

v0.1.2

Published

Line SDK wrapper for Expo 🚀

Downloads

224

Readme

React Native LINE

This library includes:

Installation

First, install the npm package with npx.

  npx expo install expo-line-authentication

iOS Setup

  1. Follow instructions in Integrating LINE Login with your iOS app.

Android Setup

  1. In your manifest add xmlns:tools="http://schemas.android.com/tools" in your manifest tag and also tools:replace="android:allowBackup" in your application tag

API

First, require the ExpoLineModule module:

import * as Line from 'expo-line-authentication';

Line.setup({channelID: 'YOUR-CHANNEL-ID'});

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

Return values

The following objects are returned on the methods described above:

  1. UserProfile:
{
   /// 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
}
  1. AccessToken:
{
   /// 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
}
  1. AccessTokenVerifyResult:
{
  // 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
}
  1. LoginResult
{
   /// 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
}
  1. BotFriendshipStatus
{
  friendFlag: boolean
}

Arguments

  1. LoginArguments
{
  scopes?: LoginPermission[]
  onlyWebLogin?: boolean
  botPrompt?: BotPrompt
}
  1. LoginPermission
{
  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',
}
  1. BotPrompt
{
  aggressive = 'aggressive',
  normal = 'normal',
}

Usage

  1. Login with default values:
    try {
        ...
        const loginResult = await Line.login()
        ...
    } catch (error) {
        ...
    }
  1. Login with arguments:
    try {
        ...
        const loginResult = await Line.login({
          scopes: ['email', 'profile'],
          botPrompt: 'normal'
        })
        ...
    } catch (error) {
        ...
    }
  1. Get user profile:
    try {
        ...
        const profile = await Line.getProfile()
        ...
    } catch (error) {
        ...
    }
  1. Logout
    try {
        ...
        await Line.logout()
        ...
    } catch (error) {
        ...
    }

Example

If you want to see expo-line-authentication in action, just move into the example folder and run npx expo run:ios/npx expo run:android. By seeing its source code, you will have a better understanding of the library usage.

Resourceful Projects 🌟

License

expo-line-authentication is available under the MIT license. See the LICENCE file for more info.