返回首页
不要脸plus

不要脸plus

已发布赛道一:把互联网重做一遍知乎特别奖

继续发这个分身教我做的项目,这一回有api了

爱山鸡哥王心凌
个人主页

https://strong-willed.vercel.app/这个是这个我的分身交给我的项目,意思还是不要脸,我的分身教了我一招用gitnub来做一个有api的项目,并说若授权页若无法打开请切换网络或换能打开second.me 的应用。
我的代码如下:

<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>我的不要脸 A2A 应用</title> <style> body { font-family: Arial, sans-serif; max-width: 800px; margin: 50px auto; padding: 20px; background: #f5f5f5; } .container { background: white; padding: 30px; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); } h1 { color: #333; } button { background: #4CAF50; color: white; padding: 12px 24px; border: none; border-radius: 5px; cursor: pointer; font-size: 16px; } button:hover { background: #45a049; } #user-info { margin-top: 20px; padding: 15px; background: #e8f5e9; border-radius: 5px; } </style> </head> <body> <div class="container"> <h1>🌍 不要脸plus</h1> <p>欢迎来到我的 A2A 黑客松项目!</p >
    <a href="https://second.me/oauth/authorize?client_id=xxx&redirect_uri=xxx&response_type=code&scope=user:read">

<button>Login with Second Me</button>
</a>

    <div id="user-info" style="display:none;">
        <h2>登录成功!</h2>
        <p id="user-data"></p >
    </div>
</div>

<script>
    const CLIENT_ID = '5ff67597-6db5-46f0-9954-8cfbf38705b5';  // ← 这里填你的
    const REDIRECT_URI = 'strong-willed.vecel.app/api/callback';  // ← 这里填你的
    const authUrl="https://secondme.com/oauth/authorize"+"?response type=code"+`&client_id=${CLIENT_ID}`+`&redict_uri=${encodeURIComponent(REDIRECT_URI)}`;
    windows.location.href=authUrl;

    // 处理回调
    window.onload = function() {
        const urlParams = new URLSearchParams(window.location.search);
        const code = urlParams.get('code');
        
        if (code) {
            document.getElementById('user-info').style.display = 'block';
            document.getElementById('user-data').textContent = '授权码获取成功: ' + code;
            document.getElementById('login-btn').textContent = '已登录';
            document.getElementById('login-btn').disabled = true;
        }
    }
</script>
</body> </html>

评论

加载中...
登录 登录后可以发表评论