purinwang / line_login
line_login V2.1
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/purinwang/line_login
Requires
- vlucas/phpdotenv: 4.2.2
Requires (Dev)
- php: >=5.6
- phpunit/phpunit: ^5.7.27
This package is auto-updated.
Last update: 2025-11-29 03:54:14 UTC
README
composer require purinwang/line_login
Require
- php >= 5.6
- line login 2.1
Flow
-
Set
ConfigManager, default use .env to settingCould rename .env.example to .env
-
Use
LineAuthorizationto get Line Login url, then redriect to Line Login page -
After click login, it will callback to
line_redirect_uriand useGet MethodreturncodeparameterThe .env
line_redirect_uriwill control Callback url -
Get User info (Two Way)
4.1 New
OAuthController, and usegetAccessTokenwithcodeto get user infoinclude
access_token, expires_in,id_token,refresh_token, scope, token_typeThen new
LineProfileController, and usegetUserprofilewithaccess_tokento get user detailinclude
userId,displayName,pictureUrl,statusMessage4.2 New
OAuthControllerand usegetDecodeIdDatawithcodeto get user info withemailinclude
iss(url),sub(UserId),name,picture,email...If you need to get
emailfield, you need to apply permission at LINE Develope and usegetDecodeIdData
Notice
-
some method cloud use detail parameter to get real callback info or it will get a part of function assign data
public function getDecodeIdData($code, $detail=false){ ... -
About getDecodeIdData, get
getAccessTokentheTokenIdis JWT format.After explode by
., it will get three part and encode by base64- header
- payload -> real data
- signature
-
Example branch is a simple login example