UNPKG

line-login

Version:

SDK to use LINE Login in express based node.js application

1,957 lines (509 loc) 21.9 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: LineLogin</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Class: LineLogin</h1> <section> <header> <h2><span class="attribs"><span class="type-signature"></span></span>LineLogin<span class="signature">(options)</span><span class="type-signature"></span></h2> </header> <article> <div class="container-overview"> <h4 class="name" id="LineLogin"><span class="type-signature"></span>new LineLogin<span class="signature">(options)</span><span class="type-signature"></span></h4> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>channel_id</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last">LINE Channel Id</td> </tr> <tr> <td class="name"><code>channel_secret</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last">LINE Channel secret</td> </tr> <tr> <td class="name"><code>callback_url</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last">LINE Callback URL</td> </tr> <tr> <td class="name"><code>scope</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> "profile openid" </td> <td class="description last">Permission to ask user to approve. Supported values are "profile", "openid" and "email". To specify email, you need to request approval to LINE.</td> </tr> <tr> <td class="name"><code>prompt</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last">Used to force the consent screen to be displayed even if the user has already granted all requested permissions. Supported value is "concent".</td> </tr> <tr> <td class="name"><code>bot_prompt</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> "normal" </td> <td class="description last">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".</td> </tr> <tr> <td class="name"><code>verify_id_token</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> true </td> <td class="description last">Used to verify id token in token response. Default is true.</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="line-login.js.html">line-login.js</a>, <a href="line-login.js.html#line16">line 16</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="._random"><span class="type-signature">(static) </span>_random<span class="signature">()</span><span class="type-signature"> &rarr; {Number}</span></h4> <div class="description"> Method to generate random string. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="line-login.js.html">line-login.js</a>, <a href="line-login.js.html#line290">line 290</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Number</span> </dd> </dl> <h4 class="name" id="auth"><span class="type-signature"></span>auth<span class="signature">()</span><span class="type-signature"> &rarr; {function}</span></h4> <div class="description"> Middlware to initiate OAuth2 flow by redirecting user to LINE authorization endpoint. Mount this middleware to the path you like to initiate authorization. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="line-login.js.html">line-login.js</a>, <a href="line-login.js.html#line65">line 65</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">function</span> </dd> </dl> <h4 class="name" id="callback"><span class="type-signature"></span>callback<span class="signature">(s, f)</span><span class="type-signature"></span></h4> <div class="description"> Middleware to handle callback after authorization. Mount this middleware to the path corresponding to the value of Callback URL in LINE Developers Console. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>s</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">Callback function on success.</td> </tr> <tr> <td class="name"><code>f</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">Callback function on failure.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="line-login.js.html">line-login.js</a>, <a href="line-login.js.html#line81">line 81</a> </li></ul></dd> </dl> <h4 class="name" id="get_friendship_status"><span class="type-signature"></span>get_friendship_status<span class="signature">(access_token)</span><span class="type-signature"> &rarr; {Object}</span></h4> <div class="description"> Method to get the friendship status of the user and the bot linked to your LNIE Login channel. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>access_token</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Access token.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="line-login.js.html">line-login.js</a>, <a href="line-login.js.html#line269">line 269</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> <h4 class="name" id="get_user_profile"><span class="type-signature"></span>get_user_profile<span class="signature">(access_token)</span><span class="type-signature"> &rarr; {Object}</span></h4> <div class="description"> Method to get user's display name, profile image, and status message. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>access_token</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Access token.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="line-login.js.html">line-login.js</a>, <a href="line-login.js.html#line247">line 247</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> <h4 class="name" id="issue_access_token"><span class="type-signature"></span>issue_access_token<span class="signature">(code)</span><span class="type-signature"> &rarr; {Object}</span></h4> <div class="description"> Method to retrieve access token using authorization code. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>code</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Authorization code</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="line-login.js.html">line-login.js</a>, <a href="line-login.js.html#line154">line 154</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> <h4 class="name" id="make_auth_url"><span class="type-signature"></span>make_auth_url<span class="signature">(nonce<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {String}</span></h4> <div class="description"> Method to make authorization URL </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>nonce</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">A string used to prevent replay attacks. This value is returned in an ID token.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="line-login.js.html">line-login.js</a>, <a href="line-login.js.html#line136">line 136</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> <h4 class="name" id="refresh_access_token"><span class="type-signature"></span>refresh_access_token<span class="signature">(refresh_token)</span><span class="type-signature"> &rarr; {Object}</span></h4> <div class="description"> Method to get a new access token using a refresh token. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>refresh_token</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Refresh token.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="line-login.js.html">line-login.js</a>, <a href="line-login.js.html#line198">line 198</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> <h4 class="name" id="revoke_access_token"><span class="type-signature"></span>revoke_access_token<span class="signature">(access_token)</span><span class="type-signature"> &rarr; {Null}</span></h4> <div class="description"> Method to invalidate the access token. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>access_token</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Access token.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="line-login.js.html">line-login.js</a>, <a href="line-login.js.html#line223">line 223</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Null</span> </dd> </dl> <h4 class="name" id="verify_access_token"><span class="type-signature"></span>verify_access_token<span class="signature">(access_token)</span><span class="type-signature"> &rarr; {Object}</span></h4> <div class="description"> Method to verify the access token. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>access_token</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Access token</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="line-login.js.html">line-login.js</a>, <a href="line-login.js.html#line180">line 180</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="LineLogin.html">LineLogin</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Mar 14 2018 13:39:58 GMT+0900 (JST) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>