line-node

LINE SDK for TypeScript

Usage no npm install needed!

<script type="module">
  import lineNode from 'https://cdn.skypack.dev/line-node';
</script>

README

LINE NODE

npm i line-node

LINE NodeJS SDK.

NodeJS helper functions for LINE

Please note that the Node only helpers cannot be used in a browser environment!

Node helpers use GOT as dependency to make requests.

Functions:

import { issueAccessToken } from 'line-ts'

const payload = { code, redirect_uri, client_id, client_secret }
const result = await issueAccessToken(payload)

// result looks like:
{ access_token, expires_in, id_token, refresh_token, scope, token_type }
import { decodeIdToken } from 'line-ts'

const payload = `line.id.token`
const result = await decodeIdToken(payload)

// result looks like:
{ header, payload, signature }
// you can retrieve information from the payload:
//   sub is the user id
{ sub, name, picture, email } = payload

For more information, click on the function links where you can see further documentation & types.

TypeScript helper functions for LINE

Check line-ts for TypeScript helper functions including:

  • getLineLoginUrl
  • getParamsFromLoginCallback