【发布时间】:2022-02-02 17:28:16
【问题描述】:
简介
我想将Appsmith 用于内部应用程序。
在我的 Appsmith 应用程序中,我需要登录 Office365 用户。
据我了解,要做到这一点,我必须“代表用户获取访问权限”,如 here 所述。
In this tutorial,朋友正在描述如何为 MS Graph API 调用执行 Postman 请求,我能够成功地做到这一点。
Appsmith 还提供“创建新 API”选项,您还可以在其中拥有 OAuth 2.0 身份验证数据源,我可以在其中运行我的 HTTP 请求并获取响应。
问题
In this tutorial 从我分享它的那一刻起,用户需要按下按钮才能获得新的访问令牌。我想知道这是否可以在 Appsmith ONLY 从应用程序的用户界面中完成,或者在 Postman 中完成,而无需按下“获取新访问令牌”按钮。
编辑
更详细地说,我想在 Appsmith 中仅通过 UI 实现以下流程。
-
向
https://login.microsoftonline.com/{{tenant_id}}/oauth2/v2.0/authorize?client_id={{client_id}}6&response_type=code&redirect_uri=https://app.appsmith.com/api/v1/datasources/authorize&response_mode=query&scope=offline_access%20user.read%20mail.read&state=12345发出GET请求 -
通过对话框用我的账号登录
-
重定向到
https://app.appsmith.com/api/v1/datasources/authorize?code=[code] -
向
https://login.microsoftonline.com/{{tenant_id}}/oauth2/v2.0/token发出POST请求
与身体:
{
code: [code] (how do I get it),
client_secret: {{client_secret}},
client_id: {{client_id}},
scope: https://graph.microsoft.com/User.Read,
redirect_uri: https://app.appsmith.com/api/v1/datasources/authorize
}
所以,主要问题是:如何从第 3 步获取 [代码],以便在第 4 步的正文中使用它
编辑 2
Appsmith 还提供curl 选项。我可以通过 curl 解决这个问题吗?
【问题讨论】:
标签: oauth-2.0 microsoft-graph-api postman appsmith