返回首页

不要脸plus
已发布赛道一:把互联网重做一遍知乎特别奖继续发这个分身教我做的项目,这一回有api了
爱山鸡哥王心凌
个人主页
https://strong-willed.vercel.app/这个是这个我的分身交给我的项目,意思还是不要脸,我的分身教了我一招用gitnub来做一个有api的项目,并说若授权页若无法打开请切换网络或换能打开second.me 的应用。
我的代码如下:
<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>评论
加载中...
登录 登录后可以发表评论

