Hi all,
while building a item view app and backend integration that stay on monday code.
when i using the session token from item view on backend to send query i got a :
{ errors: [ ‘Not Authenticated’ ] }
my flow is
- get sessionToken from itemView and send it to back in authorization header.
- verify the token with CLIENT_SECRET_KEY
- try using the session token for queries and here my error
the response of mondayApiResult
{ errors: [ ‘Not Authenticated’ ] }
the response of jwtData
{
dat: {
client_id: ‘myclientId’,
user_id: 565129,
account_id: 21579,
slug: ‘toorefo’,
app_id: 10139,
app_version_id: 10882,
install_id: -2,
is_admin: true,
is_view_only: false,
is_guest: false,
user_kind: ‘admin’
},
exp: 1712080413
}
i really appreciate any help
code in BE :
let { authorization } = req.headers;
if (!authorization && req.query) {
authorization = req.query.token;
const { sourceItemId } = req.body.payload.inputFields;
console.log('jwtData', jwt.verify(
authorization,
getSecret(MONDAY_CLIENT_SECRET)
))
const query = `query {
items (ids: ${sourceItemId}) {
name
column_values {
value
type
id
column {
id
title
}
}
}
}`;
const monday = mondaySdk()
monday.setToken(token)
const mondayApiResult = await monday.api( query);
console.log('mondayApiResult', mondayApiResult)
}```