Skip to content

stanma9107/expo-line-login

Repository files navigation

Expo Line Login

Installation

npx expo install expo-line-login

Prerequisites

  • Please create a Line Login channel and get the channel ID from Line Developer Console.
  • Please add your app schema and package name into the "App settings" fields in the "LINE Login" section of the Line Developer Console.
  • Please add the following config in your app.json
{
  "expo": {
    "plugins": [
      [
        "expo-line-login", {
          "channelId": "YOUR_CHANNEL_ID", // repleace with your channel ID
        }
      ]
    ]
  }
}

Usage

Login

import { 
  login,
  LoginPermission,
  BotPrompt,
} from 'expo-line-login';

const result = await login({
  [
    LoginPermission.PROFILE,
    LoginPermission.OPEN_ID,
    LoginPermission.EMAIL,
  ],
  BotPrompt.NORMAL,
});
console.log(result);

Get Profile

import { getProfile } from 'expo-line-login';

const profile = await getProfile();
console.log(profile);

Logout

import { logout } from 'expo-line-login';

await logout();

Get Access Token

import { getAccessToken } from 'expo-line-login';

const accessToken = await getAccessToken();
console.log(accessToken);

Get Friendship Status

import { lineGetBotFriendshipStatus } from 'expo-line-login';

const friendshipStatus = await lineGetBotFriendshipStatus();
console.log(friendshipStatus);