Skip to main content
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)
});

 

Best answer by PhongVu

tony.gamble wrote:

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.

View original
Did this thread help you find an answer to your question?

PhongVu
Community Manager
Forum|alt.badge.img
  • Community Manager
  • August 1, 2024

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...'
}

 


PhongVu
Community Manager
Forum|alt.badge.img
  • Community Manager
  • August 2, 2024
tony.gamble wrote:

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


PhongVu
Community Manager
Forum|alt.badge.img
  • Community Manager
  • August 2, 2024
tony.gamble wrote:

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

 


PhongVu
Community Manager
Forum|alt.badge.img
  • Community Manager
  • August 3, 2024
tony.gamble wrote:

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings