首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Ory Hydra中如何将代码交换成令牌

Ory Hydra中如何将代码交换成令牌
EN

Stack Overflow用户
提问于 2022-01-20 14:37:23
回答 1查看 632关注 0票数 0

我在跟踪奥利九头蛇5分钟教程

本教程使用一个示例Webapp,我试图了解如何通过HTTP将代码转换为令牌的流程。

我在这篇文章上有几个问题:

400 Bad Request Request parameter 'grant_type' is missing

400 Bad Request "invalid_grant"

401 Unauthorized "invalid_client"

现在还不清楚该怎么做。

EN

回答 1

Stack Overflow用户

发布于 2022-01-20 15:08:43

客户端创建

  • 在创建客户端期间,请确保添加--token-endpoint-auth-method client_secret_post,以便http在以后成为合法
  • 有自己的登陆页(为了方便起见,可以从http请求中打印代码)
代码语言:javascript
复制
docker-compose -f quickstart.yml exec hydra     hydra clients create     --endpoint http://127.0.0.1:4445     --id helloworld-auth-code-client     --secret secret     --grant-types authorization_code,refresh_token     --response-types code,id_token     --scope openid,offline   --token-endpoint-auth-method client_secret_post  --callbacks http://127.0.0.1:3344/loggedin

登录和检索代码

触发器登录http://127.0.0.1:4444/oauth2/auth?client_id=helloworld-auth-code-client&response_type=code&scope=openid offline&state=hniavseoniasethiohsaent

将代码转换为令牌

代码语言:javascript
复制
POST
http://127.0.0.1:4444/oauth2/token
header: Content-Type application/x-www-form-urlencoded
Body: (no curly brackets, just replace the code below and take the following)
response_type=token&grant_type=authorization_code&code=PUTYOURCODEHERE&redirect_uri=http://127.0.0.1:3344/loggedin&client_id=helloworld-auth-code-client&client_secret=secret
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70788098

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档