new LineLogin(options)
Parameters:
Name |
Type |
Description |
options |
Object
|
Properties
Name |
Type |
Attributes |
Default |
Description |
channel_id |
String
|
|
|
LINE Channel Id |
channel_secret |
String
|
|
|
LINE Channel secret |
callback_url |
String
|
|
|
LINE Callback URL |
scope |
String
|
<optional>
|
"profile openid"
|
Permission to ask user to approve. Supported values are "profile" and "openid". |
prompt |
String
|
<optional>
|
|
Used to force the consent screen to be displayed even if the user has already granted all requested permissions. Supported value is "concent". |
bot_prompt |
string
|
<optional>
|
"normal"
|
Displays an option to add a bot as a friend during login. Set value to either normal or aggressive. Supported values are "normal" and "aggressive". |
session_options |
Object
|
<optional>
|
|
Option object for express-session. Refer to https://github.com/expressjs/session for detail. |
verify_id_token |
Boolean
|
<optional>
|
true
|
Used to verify id token in token response. Default is true. |
|
- Source:
Methods
(static) _generate_state() → {Number}
Method to generate random number.
- Source:
Returns:
-
Type
-
Number
auth(nonceopt) → {function}
Middlware to initiate OAuth2 flow by redirecting user to LINE authorization endpoint.
Mount this middleware to the path you like to initiate authorization.
Parameters:
Name |
Type |
Attributes |
Description |
nonce |
String
|
<optional>
|
String to prevent reply attack. |
- Source:
Returns:
-
Type
-
function
callback(s, f)
Middleware to handle callback after authorization.
Mount this middleware to the path corresponding to the value of Callback URL in LINE Developers Console.
Parameters:
Name |
Type |
Description |
s |
function
|
Callback function on success. |
f |
function
|
Callback function on failure. |
- Source:
get_friendship_status(access_token) → {Object}
Method to get the friendship status of the user and the bot linked to your LNIE Login channel.
Parameters:
Name |
Type |
Description |
access_token |
String
|
Access token. |
- Source:
Returns:
-
Type
-
Object
get_user_profile(access_token) → {Object}
Method to get user's display name, profile image, and status message.
Parameters:
Name |
Type |
Description |
access_token |
String
|
Access token. |
- Source:
Returns:
-
Type
-
Object
issue_access_token(code) → {Object}
Method to retrieve access token using authorization code.
Parameters:
Name |
Type |
Description |
code |
String
|
Authorization code |
- Source:
Returns:
-
Type
-
Object
make_auth_url(nonceopt) → {String}
Method to make authorization URL
Parameters:
Name |
Type |
Attributes |
Description |
nonce |
String
|
<optional>
|
A string used to prevent replay attacks. This value is returned in an ID token. |
- Source:
Returns:
-
Type
-
String
refresh_access_token(refresh_token) → {Object}
Method to get a new access token using a refresh token.
Parameters:
Name |
Type |
Description |
refresh_token |
String
|
Refresh token. |
- Source:
Returns:
-
Type
-
Object
revoke_access_token(access_token) → {Null}
Method to invalidate the access token.
Parameters:
Name |
Type |
Description |
access_token |
String
|
Access token. |
- Source:
Returns:
-
Type
-
Null
verify_access_token(access_token) → {Object}
Method to verify the access token.
Parameters:
Name |
Type |
Description |
access_token |
String
|
Access token |
- Source:
Returns:
-
Type
-
Object