Q&A

LIFF getFriendship it has some wrong

前提・実現したいこと

I want to get friendship status in LIFF But it has some wromg.

発生している問題・エラーメッセージ

liff.getFriendship() Error Code: 401 Error Message: The access token revoked

該当のソースコード

<!DOCTYPE html>

<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>LIFF</title> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"/> <meta http-equiv="Pragma" content="no-cache"/> <meta http-equiv="Expires" content="0"/> <link rel="shortcut icon" href="#"/> <script src="https://cdn.jsdelivr.net/npm/vconsole@3.2.0/dist/vconsole.min.js"></script> <script> var vConsole = new VConsole(); </script> <script src="js/jquery/jquery.min.js"></script> <script charset="utf-8" src="https://static.line-scdn.net/liff/edge/versions/2.3.1/sdk.js"></script> <script type="text/javascript"> var friendFlag = 'N'; window.onload = function () { liff .init({ liffId: 'XXXXXXXXXX-XXXXXXXXXXXXX' }) .catch((error) => { console.log('liff.init', error); }); liff.ready.then(async () => { await liff.getFriendship() .then(data => { if (data.friendFlag == true) { friendFlag = 'Y'; } }) .catch((error) => { console.log('liff.getFriendship', error); }); }); } </script> </head> <body> </body> </html>

試したこと

Not everyone happened

補足情報(FW/ツールのバージョンなど)

HTTP_USER_AGENT: Mozilla/5.0 (Linux; Android 9; SM-A530F Build/PPR1.180610.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/84.0.4147.125 Mobile Safari/537.36 Line/10.13.3 LIFF

{ "liffInfo": { "getOS": "android", "getLanguage": "zh-TW", "getVersion": "2.3.1", "isInClient": "true", "isLoggedIn": "true", "getContext": { "type": "utou", "utouId": "XXXXXXX", "userId": "XXXXXXX", "viewType": "full", "endpointUrl": "XXXXXXX", "permanentLinkPattern": "replace", "accessTokenHash": "XXXXXXX", "availability": { "shareTargetPicker": { "permission": "false", "minVer": "10.3.0" } } }, "getDecodedIDToken": { "iss": "https://access.line.me", "sub": "XXXXXXX", "aud": "XXXXXXX", "exp": "XXXXXXX", "iat": "XXXXXXX", "name": "XXXXXXX", "picture": "XXXXXXX" } } }

  • 0
  • 1
  • 277
  • twitter facebook

liff.getFriendship() is the friendship status of the LINE Official Account that's linked to the LINE Login channel to which the LIFF app is added. So you should link LIFF to LINE Official Account https://developers.line.biz/en/reference/liff/#get-friendship

  • 0
本当によろしいですか? question.vm