creating a private app that has no user interface, only server to Ring Central interface.
I tried this code snippet with the JWT Token created in my Sandbox with clientid and client-secret. I get the following error:
Unable to authenticate to platform. Check credentials.Either code, or username with password, or jwt has to be provided
CODE testest in python:
from ringcentral import SDK import os,sys rcsdk = SDK( os.environ.get('RC_CLIENT_ID'), os.environ.get('RC_CLIENT_SECRET'), os.environ.get('RC_SERVER_URL') ) platform = rcsdk.platform() try: platform.login( jwt=os.environ.get('RC_JWT') ) except Exception as e: print(e) sys.exit("Unable to authenticate to platform. Check credentials." + str(e)) print(f'Login with JWT successful.')
My app works fine with a user login and password, which is not practical for distribution or as secure as a JWT.
Hi @Fausto Chepil here is a sample project on GitHub that you can clone/download and run it. Just make sure to update the .env file with your credentials including JWT and it should work. The code is in Nodejs, if you need help with Python specifically let us know but with this app you can make sure your credentials and settings are all correct.
Thank you Suyash.
My guess is that you forgot to update the RingCentral Python SDK. Please double check to reinstall.
https://github.com/ringcentral/ringcentral-python
This code works perfectly for me
from ringcentral import SD RINGCENTRAL_CLIENTID = '' RINGCENTRAL_CLIENTSECRET = '' RINGCENTRAL_SERVER = 'https://platform.devtest.ringcentral.com' rcsdk = SDK( RINGCENTRAL_CLIENTID, RINGCENTRAL_CLIENTSECRET, RINGCENTRAL_SERVER) platform = rcsdk.platform() JWT_TOKEN = "jwt-token" try: platform.login( jwt=JWT_TOKEN ) params = { 'dateFrom': "2012-01-01T00:00:00.000Z" } resp = platform.get('/restapi/v1.0/account/~/extension/~/call-log', params) for record in resp.json().records: print ("Call type: " + record.type) except Exception as e: print ("Unable to authenticate to platform. Check credentials." + str(e))
Ringcentral was up to date, but its dependencies were not:
pubnub
requests
Thanks again!
Thank you again Phong!
I should have you on speed dial :)
A new Community is coming to RingCentral!
Posts are currently read-only as we transition into our new platform.We thank you for your patience
during this downtime.
Try Workflow Builder
Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!Try RingCentral Workflow Builder