0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

LINEログインしてUIDを取得

Last updated at Posted at 2022-11-22

LINEログインしてUIDを取得

<div id="liffInfo"></div>
<script charset="utf-8" src="https://static.line-scdn.net/liff/edge/versions/2.1.14/sdk.js"></script>
<script>
var myliffId = "xxxxxxxxxx-xxxxxxxx";
//document.addEventListener("DOMContentLoaded", function() {
function line_login() {
          liff
            .init({
                liffId: myliffId,
            })
            .then(() => {
                // ログインまだ
                if (!liff.isLoggedIn()) {
                        liff.login();
                } else {
                        // 通知用UID
                        document.getElementById("liffInfo").innerHTML = "あなたのLINE通知用番号は<br>";
                        document.getElementById("liffInfo").innerHTML+= liff.getContext().userId;
                }
            })
            .catch((error) => {
                console.log(error)
            })
}
//});
</script>

<button onClick="line_login();">LINEログイン</button>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?