Was*_*mbs 7 javascript oauth oauth-2.0 discord discord.js
我想知道是否可以使用 Discord OAuth(识别范围),同时还将重要的补充信息传递到重定向 URL。
site with [important variable] > oauth page > site that needs [important variable] and oauth result
Run Code Online (Sandbox Code Playgroud)
我尝试附加类似 ?variable="myString" 的内容,但它会删除除 OAuth 信息之外的所有不必要的 URL 参数。Discord OAuth 也不太喜欢在 iframe 中,所以这不是这里的解决方案。
Lev*_*hel 11
我写过一篇关于这个问题的文章,你可以在这里找到它:
https://levbuchel.com/passing-variables-through-oauth
原答案:
要通过 oAuth 进程传递变量,您应该使用stateoAuth 参数。
首先使用您的参数创建一个 Json 字符串,
例如{'first':'111', 'second':'222'}。
然后将其编码为base64,这样在作为URL传递时就不会被修改。
将此字符串作为state( api/oauth2/authorize?response_type=token&state=whatEverYouGotAsState) 传递。
然后您将能够在您的重定向 URI 上接收并解码它。
| 归档时间: |
|
| 查看次数: |
2575 次 |
| 最近记录: |