Solved

OAuth: What am I receiving invalid_client mean when trying having access token ?

  • 9 January 2024
  • 1 reply
  • 84 views

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());
};

 

icon

Best answer by Javier - Developer Relations 11 January 2024, 19:19

View original

1 reply

Userlevel 5
Badge +8

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