Name: line-login-guide-faq
Owner: LINE
Description: null
Created: 2017-09-28 04:14:19.0
Updated: 2017-09-28 05:01:16.0
Pushed: 2017-09-28 06:37:34.0
Homepage: null
Size: 6
Language: PHP
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
???LINE Devlopers??LINE Login??????????????
???????LINE Login v2.1???????????????
???????????????
??????????????????
s://access.line.me/dialog/oauth/weblogin
s://api.line.me/v2/oauth/accessToken
s://api.line.me/v2/oauth/revoke
s://acces.line.me/oauth2/v2.1/authorize
s://api.line.me/oauth2/v2.1/token
s://api.line.me/oauth2/v2.1/revoke
OpenID????????scope????????openid??????ID_TOKEN??????????????
= 'https://access.line.me/oauth2/v2.1/authorize?scope=openid%20profile&response_type=code&client_id=' . getenv('LOGIN_CHANNEL_ID') . '&redirect_uri=' . $callback . '&state=' . $csrf_value;
'<a href=' . $url . '><button class="btn">Login using OpenID Connect</button></a>' . PHP_EOL;
???????????????????????????????????????ID_TOKEN???????
rl = 'https://api.line.me/oauth2/v2.1/token';
ata = array(
'grant_type' => 'authorization_code',
'client_id' => getenv('LOGIN_CHANNEL_ID'),
'client_secret' => getenv('LOGIN_CHANNEL_SECRET'),
'code' => $_GET['code'],
'redirect_uri' => $callback
ata = http_build_query($data, '', '&');
eader = array(
'Content-Type: application/x-www-form-urlencoded'
ontext = array(
'http' => array(
'method' => 'POST',
'header' => implode('\r\n', $header),
'content' => $data
)
esultString = file_get_contents($url, false, stream_context_create($context));
esult = json_decode($resultString, true);
f(isset($result['id_token'])) {
$val = explode(".", $result['id_token']);
$data_json = base64UrlDecode($val[1]);
error_log($data_json);
}
tion base64UrlDecode($data) {
eplaced = str_replace(array('-', '_'), array('+', '/'), $data);
ack = strlen($replaced) % 4;
($lack > 0) {
$replaced .= str_repeat("=", 4 - $lack);
turn base64_decode($replaced);
hell-session
s":"https://access.line.me","sub":"userIdXXXXXXXXXXXXX","aud":"1508850331","exp":1506342586,"iat":1506338986,"name":"??","picture":""}
Login????BOT?ID????????????????????????????
2???????????bot_prompt???????normal??????????????????????????????????
= 'https://access.line.me/oauth2/v2.1/authorize?scope=profile&bot_prompt=normal&response_type=code&client_id=' . getenv('LOGIN_CHANNEL_ID') . '&redirect_uri=' . $callback . '&state=' . $csrf_value;
'<a href=' . $url . '><button class="btn">Login v2.1</button></a>' . PHP_EOL;
bot_prompt???????aggressive???????????????????????????????????
= 'https://access.line.me/oauth2/v2.1/authorize?scope=profile&bot_prompt=aggressive&response_type=code&client_id=' . getenv('LOGIN_CHANNEL_ID') . '&redirect_uri=' . $callback . '&state=' . $csrf_value;
'<a href=' . $url . '><button class="btn">Login v2.1</button></a>' . PHP_EOL;
????????????BOT???????????????????????????????????????????????????????????????????????????????
prompt??????consent??????????????????????????????????????????????????????
= 'https://access.line.me/oauth2/v2.1/authorize?scope=profile&prompt=consent&response_type=code&client_id=' . getenv('LOGIN_CHANNEL_ID') . '&redirect_uri=' . $callback . '&state=' . $csrf_value;
'<a href=' . $url . '><button class="btn">Login v2.1</button></a>' . PHP_EOL;