Hello, please help me fix error. Why this request does not work. All worked yesterday.
This is my code, when I get code and api works i get error
const getGrand = async(token: string) => {
console.log(token, 'tocken')
try {
const response = await fetch('https://api.us.nylas.com/v3/connect/token', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Basic ${NylasConfig.apiKey}`,
},
body: JSON.stringify({
client_id: `${NylasConfig.clientIdNylas}`,
client_secret: `${NylasConfig.apiKey}`,
grant_type: 'authorization_code',
code: token,
redirect_uri:'http://localhost:8080/choosecalendar',
}),
});
if (!response.ok) {
throw new Error('Network response was not ok');
}
const dataConnectToken = await response.json();
console.log(dataConnectToken, 'dataConnectToken')
} catch (error) {
}
}