Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

libai / footseen-large-website

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Switch branch/tag
  • footseen-large-website
  • lineBack.html
Find file
BlameHistoryPermalink
  • libai's avatar
    测试 · 713614cd
    libai committed 2 years ago
    713614cd
lineBack.html 3.4 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94

<!DOCTYPE html>
<html lang="en">
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-QT401FZZ2K"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-QT401FZZ2K');
</script>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>LINE Login</title>
    <style>
        #timeJump {
            display: none;
        }
    </style>
</head>

<body>
    <!-- <h1 id="timeJump">登錄成功,<span id="jTime">5</span>秒后返回App</h1> -->
    <script type="text/javascript" src="lib/jquery-3.1.1.min.js"></script>
    <script src="lib/default.js"></script>
    <script>
        var urlParam = url_get_params();
        $.ajax({
            url: 'https://api.line.me/oauth2/v2.1/token',
            data: {
                grant_type: 'authorization_code',
                code: urlParam.code,
                redirect_uri: 'https://www.footseen.xyz/lineBack.html',
                client_id: '1654468829',
                client_secret: 'd70325add488ea05fd25ba84c6d91b6c'
            },
            type: 'POST',
            success: function (res) {
                var mAutho = res;
                $.ajax({
                    url: 'https://api.line.me/oauth2/v2.1/verify',
                    type: 'POST',
                    data: {
                        client_id: '1654468829',
                        id_token: mAutho.id_token
                    },
                    success: function (res) {
                        //console.log('line',res)
                        $.ajax({
                            url:$ip+'third/login',
                            data:{
                                openid:res.sub,
                                opentype:8,
                                authToken:mAutho.id_token,
                                nickname:res.name,
                                facepath:res.picture
                            },
                            success:function(data){
                                //console.log('line',data)
                                if(data.code!=1){
                                    layer.msg(data.msg)
                                    return;
                                }
                                localStorage.token=data.token
                                localStorage.uid=data.uid
                                window.location.href='index.html'
                            }
                        })
                        // window.location.href = "footseenlogin://" + encodeURIComponent("www.firefly.live?token=" + mAutho.id_token + "&name=" + res.name + "&profileImageUrl=" + res.iss + "&id=" + res.sub);
                    }
                })

            }
        })
  
        function url_get_params() {
            var url = location.href;
            var theRequest = new Object();
            if (url.indexOf("?") != -1) {
                var str = url.substr(url.indexOf("?") + 1);
                strs = str.split("&");
                for (var i = 0; i < strs.length; i++) {
                    theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
                }
            }
            return theRequest;
        }
    </script>
</body>

</html>