英文:
Firestore token with Postman?
问题
我需要在Postman中的Firestore请求中获取一个Bearer令牌。请问如何在Postman中获取Firestore数据库的令牌?
英文:
I realize that this question has been asked a few times but I don't think it has been answered. I need to get a bearer token for firestore. I can get it using a command line gcloud statement perfectly well, no problem. But I need to do it within postman as a request. What are the steps to get a token from a firestore DB with postman, specifically?
答案1
得分: 0
你可以使用Postman执行以下步骤来获取Firestore的令牌:
- 在Postman中创建一个新的请求。
- 在请求URL字段中输入:https://www.googleapis.com/oauth2/v4/token。
- 在请求体选项卡下选择x-www-form-urlencoded选项。
- 在键字段中输入grant_type。
- 在值字段中输入urn:ietf:params:oauth:grant-type:jwt-bearer。
- 在键字段中输入assertion。
- 在值字段中输入你生成的JWT令牌。
- 将请求方法设置为POST。
- 点击“发送”按钮将请求发送到服务器。
- 服务器应该会以JSON对象的形式响应,其中包含在“access_token”字段中的访问令牌。
请记住,获取授权令牌需要具有适当的权限和身份验证设置。另外,请确认你生成的JWT令牌具有访问Firestore数据库所需的适当范围和权限。
英文:
<p style="margin: 0;">You can use Postman to perform the following steps to get a bearer token for Firestore:</p>
<ol>
<li>Create a new request in Postman.</li>
<li>Input the request URL field: https://www.googleapis.com/oauth2/v4/token</li>
<li>Choose the x-www-form-urlencoded option under the request body tab.</li>
<li>In the Key field, enter grant_type.</li>
<li>In the Value field, enter urn:ietf:params:oauth:grant-type:jwt-bearer.</li>
<li>In the Key field, enter assertion.</li>
<li>In the Value field, enter the JWT token you generated.</li>
<li>Set the request method to POST.</li>
<li>Click the "Send" button to send the request to the server.</li>
<li>The server should respond with a JSON object containing the access token in the "access_token" field.</li>
</ol>
<p style="margin: 0; ;margin: 0;">Keep in mind that getting an authorized token requires having the appropriate permissions and authentication setup. Additionally, confirm that the JWT token you generated has the appropriate scopes and permissions needed to access the Firestore DB.</p>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论