Skip to main content
The First Step
November 23, 2022
Solved

Issues with Python & SMS demo app

Hi folks,

I am juuuust getting started with RingCentral & Python, trying to run the sms.py sample app. I filled out .ENV as required, however, cannot run sms.py without error. I get the error:

Unable to authenticate to platform. Check credentials. Either code, or username with password, or jwt has to be provided

I have provided username, password, Client ID, etc. in .ENV and it is as if the script is ignoring it. I see a line of the script that says:

platform.login(jwt=os.environ.get('RC_JWT'))

which leads me to belive this sample .py file defaults to using JWT authentication? If so, how do I change it? If not, what might be wrong with my implementation?


Thank You!

PhongVu
PhongVuAnswer
Community Manager
November 24, 2022

If you want to use username and password flow, you can define the username, password and extension number in your .env file and call the login method like this.

platform.login(os.environ.get('RC_USERNAME', os.environ.get('RC_EXTENSION', os.environ.get('RC_PASSWORD'))

We recommend developers to use JWT auth though.

2 replies

PhongVu
Community Manager
PhongVuAnswer
Community Manager
November 24, 2022

If you want to use username and password flow, you can define the username, password and extension number in your .env file and call the login method like this.

platform.login(os.environ.get('RC_USERNAME', os.environ.get('RC_EXTENSION', os.environ.get('RC_PASSWORD'))

We recommend developers to use JWT auth though.

nbungeThe First StepAuthor
The First Step
November 25, 2022

Thank you sir, this was exactly what I was looking for. Just wanted to get a rough proof together before I dive into JWT :)