gpt4 book ai didi

rest - 如何使用 POSTMAN 客户端发布凭据以创建基于 cookie 的 session

转载 作者:行者123 更新时间:2023-12-04 22:57:15 26 4
gpt4 key购买 nike

我正在使用 postman 客户端对 JIRA API 进行 REST 调用。它说“将您的凭据发布到 http://jira.example.com:8090/jira/rest/auth/1/session”以获取 session 。我尝试使用 Form-data、application/x-www-form-urlencoded、raw 等进行发布。没有任何效果。这是做到这一点的正确方法。

这是我正在关注的教程:https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-cookie-based-authentication

最佳答案

由于您使用的是 postman ,因此我假设您处于开发环境中。在这种情况下,使用 auth header 可能更简单,它是 base-64 编码的用户名/密码。来自文档 here :

Supplying Basic Auth headers

If you need to you may construct and send basic auth headers yourself. To do this you need to perform the following steps: Build a string of the form username:password Base64 encode the string Supply an "Authorization" header with content "Basic " followed by the encoded string. For example, the string "fred:fred" encodes to "ZnJlZDpmcmVk" in base64, so you would make the request as follows.

curl -D- -X GET -H "Authorization: Basic ZnJlZDpmcmVk" -H "Content-Type: application/json" "http://kelpie9:8081/rest/api/2/issue/QA-31"



Headers postman 部分,加 AuthorizationBasic <base64-encoded-username:password>
不要忘记添加标题 Content-Typeapplication/json
(您可以使用 base64encode.org 快速编码您的用户名/密码)。
不要忘记将字符串输入为 username-colon-password ( username:password )

关于rest - 如何使用 POSTMAN 客户端发布凭据以创建基于 cookie 的 session ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40009221/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com