Skip to main content

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

 

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)

 


yes, the env variables are being loaded as expected:

 

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

 


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


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


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


oh, the client id is:

AV0pSJy794tfaI6pRp6wfr

 


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.


Thanks, this fixed the issue!


Reply