Skip to main content

Hello,

 

I am implementing OAuth and I am having an error that I don’t understand

Here is a record of the video showing the test 

 

Here is the code use to send the request for getting access token

export const getFrontAccessToken = async (code: string, slug: string) => {
const clientId = process.env.NEXT_PUBLIC_FRONT_CLIENT_ID;
const clientSecret = process.env.NEXT_PUBLIC_FRONT_CLIENT_SECRET;
const encodedAuth = btoa(`${clientId}:${clientSecret}`);
console.log('getFrontAT ', clientId, clientSecret, encodedAuth);

const response = await fetch('https://app.frontapp.com/oauth/token', {
method: 'POST',
body: JSON.stringify({
code,
// redirect_uri: `http://localhost:3000/settings/${slug}/front`,
grant_type: 'authorization_code',
}),
headers: {
'Content-Type': 'application/json',
accept: 'application/json',
Authorization: `Basic ${encodedAuth}`,
},
});
console.log(await response.json());
};

 

I believe this question was answered here: 

 

This post originally didn’t go through do to a false positive on spam filters.

Let me know if this question is different from the other post.


Reply