question

Help Center avatar image
Help Center asked Help Center commented

JWT Not Working in Production

Hi,

I am using the RC Javascript library (v4.7.0). Our app graduated from sandbox to production. To accommodate this change, we updated our server, client id, client secret, and JWT values to the production values. However, we cannot even authenticate. We get the following error:


LOG: Error caught in ringcentral.auth(), Error: Resource not found: at Client.<anonymous> (C:\D3\src\node_modules\@ringcentral\sdk\lib\http\Client.js:115:35)


Our app was set up to use JWT auth flow and the sandbox values still work. Just not the production ones. Our code is simple:


let rcsdk = new RingCentral({

server: keys.Secrets.ringcentral_server,

clientId: keys.Secrets.ringcentral_client_id,

clientSecret: keys.Secrets.ringcentral_client_secret

});


let platform = rcsdk.platform();


await platform.login({

jwt: keys.Secrets.ringcentral_jwt,

});


Like I said, if I change the ringcentral variable values above back to sandbox, we can authenticate.


To show that we are indeed in production, here is a screenshot of the credentials page for our app:


1646148632551.png


Has anyone else had this problem?

authentication
1646148632551.png (36.6 KiB)
4 comments
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Give me your app client id.

0 Likes 0 ·

It is g_qij6n3RAqIijYDyLWN5w

0 Likes 0 ·

Thanks! I look into your dev account and could not see the option to create a JWT token. Which user did you login the dev portal to create the JWT token for your app on production?

0 Likes 0 ·
Show more comments
Byrne Reese avatar image
Byrne Reese answered Help Center commented

Ok. You seem to be doing everything right. Your JWT credential is configured for use with all apps in your org Your JWT credential is set to production

And I assume: Your app is configured to call platform.ringcentral.com (not platform.devtest.ringcentral.com) You are presenting the client ID and secret of an app configured for JWT

I took the liberty of logging into your account, and using your client/secret, and the JWT token you generated above, and everything worked.

There is a remote possibility that our server cache needed to be updated in order for the JWT to be recognized. Try again now that a few minutes have passed and let me know if it works.

1 comment
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

It worked!!!

Thank you very much for your help Byrne!

0 Likes 0 ·
Byrne Reese avatar image
Byrne Reese answered Byrne Reese commented

@Help Center I checked your account to see if there was a problem, but saw none. To create a JWT follow this instructions:

  • Login to Developer Console

  • In the upper righthand corner, click your profile name

  • Select "Credentials" from the menu

  • Click "Create JWT" and you should be good to go.

2 comments
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

We have done that for both Sandbox and Production tokens. We just tried creating another one for production and it still does not work:

1646158134325.png

The sandbox token found under my account can be used. Any production token produces a Resource not found error.

0 Likes 0 ·
1646158134325.png (21.3 KiB)

Did the answer I provided work for you? If so, could you mark the "accepted answer?"

0 Likes 0 ·

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys