星期一整合到chrome扩展



你好,我正试图将周一整合到我的chrome扩展,我正在接收验证码,当我请求令牌以换取验证码时,我正在接收代码500谁能给我指个正确的方向?

我正在使用的一些代码

chrome.identity.launchWebAuthFlow(
{
interactive: true,
url: `https://auth.monday.com/oauth2/authorize?client_id=${MONDAY_CLIENT_ID}&state=${MONDAY_STATE}&redirect_uri=${MONDAY_REDIRECT_URI}&scope=me:read+boards:read+boards:write+updates:write`,
},
(url?: string) => {
let code = url.substring(url.indexOf("code=") + "code=".length);
code = code.substring(0, code.indexOf("&"));
const requestTokenUrl = new URL("https://auth.monday.com/oauth2/token");
const params = { code, client_id:MONDAY_CLIENT_ID ,client_secret:CLIENT_SECRET};
requestTokenUrl.search = new URLSearchParams(params).toString();
axios.get(requestTokenUrl.toString()).then((res)=>{
console.log(res.data)
});
}
);

查看官方文档:https://apps.developer.monday.com/docs/oauth#token-request

在我看来,你应该在你的请求中修改一些东西来发出一个令牌:

  1. 使用POST代替GET
  2. 除了代码,client_id和client_secret你应该发送redirect_uri参数,你在第一个授权请求中使用。该参数仅用于验证(没有实际的重定向)。该值必须与授权请求步骤中提供的值相匹配。

最新更新