I followed the OAuth Implementation guide & have my local server & ngrok tunnel running. Problem is when I click on the OAuth button, I get “invalid_request” - “Invalid client_id param” error even though I defined the client_id, client_secret & redirect_uri vars with the correct values ( to be certain ). What could the issue be?
*sorry for reposting…I accidentally deleted my previous post description
Edit:
In addition to the problem described above , I can’t perform a query / mutation using GraphQL. Doing so yields a 401 Unauthorized error. So yeah…sorta just stuck here since I can’t read / write to the board & idk how to resolve the issues I’m encountering with OAuth AND GraphQL.
Here’s my code:
useEffect(() => {
monday.setToken(process.env.REACT_APP_API_TOKEN);
monday.listen("settings", (res) => {
setSettings(res.data);
});
monday.listen("context", (res) => {
setContext(res.data);
});
monday
.api(
`query ($boardIds: [Int]) { boards (ids:$boardIds)
{ name items(limit:1) { name column_values { title text } } } }`,
{ variables: { boardIds: context.boardIds } }
)
.then((res) => {
setBoardData(res.data);
});
}, []);
With React hooks, I can’t query or mutate. But I found that when this code gets reformatted to its component lifecycle equivalent, then the query runs & I can fetch the data. In this case, the query runs only if I don’t set the token beforehand.
The API token is only supposed to be required for server-side code right? So then why can’t I access the GraphQL API from client-side? And why can’t I perform mutations in both React code forms? All necessary board permission scopes are configured in my monday app for client & in the node express code for server.
What am I doing wrong?