微信公众号。通过跳转到一个固定的拼接的url。然后获取到这个url页面中通过获取url上面带的参数code就行了
url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=公众号的appid&redirect_uri=${encodeURIComponent(跳转到的url的链接地址)}` + "&response_type=code&scope=snsapi_userinfo&state=" + state + "#wechat_redirect";
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
</head>
<body>
<script>