Skip to main content
The First Step
Aug 1, 2024 5:30 PM UTC
Solved

Authentication The [Audience] claim value must contain a token endpoint URL | Node SDK

Hi,

I have a basic Node app and having issues authenticating. I have set my server, clientId, secretId and jwt. However, I keep getting this error

The [Audience] claim value must contain a token endpoint URL

My code looks like:

const RC_SDK = require('@ringcentral/sdk').SDK
const path = require('path')
require('dotenv').config({ path: path.resolve(__dirname, './.env') })

var rcsdk = new RC_SDK({
'server': process.env.RC_SERVER_URL,
'clientId': process.env.RC_CLIENT_ID,
'clientSecret': process.env.RC_CLIENT_SECRET
});
var platform = rcsdk.platform();


platform.login({ 'jwt': process.env.RC_JWT })

platform.on(platform.events.loginSuccess, function(e){
console.log('LOGGED IN')
});

platform.on(platform.events.loginError, function(e){
console.log("Unable to authenticate to platform. Check credentials.", e.message)
process.exit(1)
});

 

PhongVu
PhongVuAnswer
Community Manager
Aug 3, 2024 3:15 PM UTC

oh, the client id is:

AV0pSJy794tfaI6pRp6wfr

 

I see that you have 2 JWT tokens for all apps under your organization. One JWT is for sandbox and another is for production. Can you double check if you are using the right one. Since you set the server for the production server: 'https://platform.ringcentral.com', make sure that you use the JWT for production. Otherwise, change the server to https://platform.devtest.ringcentral.com'  and try again.

8 replies

PhongVu
Community Manager
Community Manager
Aug 1, 2024 8:55 PM UTC

I don’t see anything wrong with the code. Can you print out the params you load from the .env file and check if they are all load/read correctly (for your investigation only. Don’t need to share those here!)

E.g.

console.log(process.env.RC_CLIENT_ID)
console.log(process.env.RC_JWT)

 

The First Step
Aug 2, 2024 4:48 PM UTC

yes, the env variables are being loaded as expected:

 

{
server: 'https://platform.ringcentral.com',
clientId: 'XXXXXXXX',
clientSecret: 'XXXXXXXX',
jwt: 'eyJraWQi...'
}

 

PhongVu
Community Manager
Community Manager
Aug 2, 2024 5:21 PM UTC

yes, the env variables are being loaded as expected:

 

{
server: 'https://platform.ringcentral.com',
clientId: 'XXXXXXXX',
clientSecret: 'XXXXXXXX',
jwt: 'eyJraWQi...'
}

 

Then give me the app client id

The First Step
Aug 2, 2024 8:41 PM UTC

Yes, I have given the clientId and clientSecret, the above is just not to expose my ids. I still have the same issue

PhongVu
Community Manager
Community Manager
Aug 2, 2024 10:33 PM UTC

Yes, I have given the clientId and clientSecret, the above is just not to expose my ids. I still have the same issue

What do you mean? I ask you to post the app client id here so I can check the app settings

The First Step
Aug 2, 2024 10:49 PM UTC

oh, the client id is:

AV0pSJy794tfaI6pRp6wfr

 

PhongVu
Community Manager
PhongVuAnswer
Community Manager
Aug 3, 2024 3:15 PM UTC

oh, the client id is:

AV0pSJy794tfaI6pRp6wfr

 

I see that you have 2 JWT tokens for all apps under your organization. One JWT is for sandbox and another is for production. Can you double check if you are using the right one. Since you set the server for the production server: 'https://platform.ringcentral.com', make sure that you use the JWT for production. Otherwise, change the server to https://platform.devtest.ringcentral.com'  and try again.

The First Step
Aug 5, 2024 3:05 PM UTC

Thanks, this fixed the issue!