Roblox OAuth | Client credentials are incorrect

Hello, I’m trying to make a verification system using OAuth 2.0
But for some reason I getting this error:

  error: 'invalid_grant',
  error_description: 'Client credentials are incorrect'

I checked and the state are the same, and the code is the code that the API generated for me…

Here is the code:

Roblox JS

   const clientId = process.env.ROBLOX_CLIENT_ID;
    const clientSecret = process.env.ROBLOX_CLIENT_SECRET;

    const issuer = await'')

    const client = new issuer.Client({
        client_id: clientId,
        client_secret: clientSecret,
        redirect_uris: ['http://localhost:3000/callback'],
        response_types: ['code'],
        scope: 'openid profile',

    client[custom.clock_tolerance] = 180;

    const state = generators.state();
    const authorizationUrl = client.authorizationUrl({
        scope: client.scope,


const params = client.callbackParams(req);
const code = params.code
const userState =  params.state

if (toString(userState) == toString(state)) {
	const tokenSet = await client.callback('http://localhost:3000/callback', {code, userState}); // error line

I tried to request in this way also:

const response = await fetch('', {
	method: 'POST',
	headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
	body: new URLSearchParams({
		client_id: clientId,
		client_secret: clientSecret,
		grant_type: 'authorization_code',
		code: code

I getting this error:

You passed an invalid argument, such as an invalid universeId. You might also have missing or invalid headers, such as Content-Length and Content-Type.


try {
	const tokenSet = await client.callback('http://localhost:3000/callback', { params })
} catch (err) {

But I getting this output

TokenSet {}