Capacitor plugin to support LINE Login
npm install capacitor-line-loginCapacitor plugin to support LINE Login
``bash`
npm install capacitor-line-login
npx cap sync
Update the following:
./ios/App/App/Info.plist:
`diff`
[...]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ./ios/App/App/AppDelegate.swift:`diff`
import UIKit
import Capacitor
+import LineSDK
[...]
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
// Called when the app was launched with a url. Feel free to add additional processing here,
// but if you want the App API to support tracking app url opens, make sure to keep this call
+ if LoginManager.shared.application(app, open: url) {
+ return true
+ }
return ApplicationDelegateProxy.shared.application(app, open: url, options: options)
}
`typescript`
import { LineLogin, LoginResult } from 'capacitor-line-login'
`typescript`
LineLogin.setup({ channelId: 'CHANNEL_ID' })
[...]
LineLogin.login()
.then(({ code, data }: LoginResult) => {
// ...
})
.catch(({ code, message }) => {
// ...
})
* setup(...)
* login()
* logout()
* getAccessToken()
* refreshAccessToken()
* verifyAccessToken()
* Interfaces
`typescript`
setup(options: SetupOptions) => Promise
| Param | Type |
| ------------- | ----------------------------------------------------- |
| options | SetupOptions |
--------------------
`typescript`
login() => Promise
Returns: Promise<LoginResult>
--------------------
`typescript`
logout() => Promise
Returns: Promise<Result>
--------------------
`typescript`
getAccessToken() => Promise
Returns: Promise<GetAccessTokenResult>
--------------------
`typescript`
refreshAccessToken() => Promise
Returns: Promise<GetAccessTokenResult>
--------------------
`typescript`
verifyAccessToken() => Promise
Returns: Promise<Result>
--------------------
#### SetupOptions
| Prop | Type |
| --------------- | ------------------- |
| channelId | string |
#### LoginResult
| Prop | Type |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| data | { accessToken: string; estimatedExpirationTimeMillis: number; userID: string; email?: string; displayName: string; pictureUrl?: string; } |
#### Result
| Prop | Type |
| ---------- | ----------------------------------------------------- |
| code | 'SUCCESS' \| 'CANCEL' \| 'UNKNOWN_ERROR' |
#### GetAccessTokenResult
| Prop | Type |
| ---------- | ---------------------------------------------------------------------------- |
| data` | { accessToken: string; estimatedExpirationTimeMillis: number; } |