purinwang / line_login
line_login V2.1
Requires
- vlucas/phpdotenv: 4.2.2
Requires (Dev)
- php: >=5.6
- phpunit/phpunit: ^5.7.27
This package is auto-updated.
Last update: 2024-04-29 04:47:53 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
LineAuthorization
to get Line Login url, then redriect to Line Login page -
After click login, it will callback to
line_redirect_uri
and useGet Method
returncode
parameterThe .env
line_redirect_uri
will control Callback url -
Get User info (Two Way)
4.1 New
OAuthController
, and usegetAccessToken
withcode
to get user infoinclude
access_token
, expires_in,id_token
,refresh_token
, scope, token_typeThen new
LineProfileController
, and usegetUserprofile
withaccess_token
to get user detailinclude
userId
,displayName
,pictureUrl
,statusMessage
4.2 New
OAuthController
and usegetDecodeIdData
withcode
to get user info withemail
include
iss
(url),sub
(UserId),name
,picture
,email
...If you need to get
email
field, 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
getAccessToken
theTokenId
is 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