Skip to main content
Question

New to the api ,new to using api need some help in writing a simple python code to retrieve oauth token


  • New Participant
  • 3 replies

Can someone please help me writing a simple python script to get the oauth token using api.

,

need some help in writing a simple python code to retrieve oauth token

4 replies

PhongVu
Community Manager
Forum|alt.badge.img
  • Community Manager
  • 2312 replies
  • March 25, 2021

See this tutorial. Or this quick started sample using the Python SDK.


  • Author
  • New Participant
  • 3 replies
  • March 26, 2021

Is there a example without using the sdk

because when i use SDK i keep getting this error

ImportError: cannot import name 'SDK' from partially initialized module 'ringcentral' (most likely due to a circular import)


PhongVu
Community Manager
Forum|alt.badge.img
  • Community Manager
  • 2312 replies
  • March 26, 2021

That is the tutorial is about "Access RingCentral platform services using Python native API."


PhongVu
Community Manager
Forum|alt.badge.img
  • Community Manager
  • 2312 replies
  • March 29, 2021

I don't know what you want to refer to. That code is the RingCentral Python SDK, which helps developers easier to login RingCentral platform. It can be used to login with password flow or OAuth authorization.

To be honest, I don't know what you want to do as your original question is about how to retrieve auth token.

After you log in either ways, you will get the access tokens. And this sample code helps you to achieve the tokens via OAuth. Your problem is you don't know Flask so you cannot use the code as such. But it should help with the basic steps.

https://developers.ringcentral.com/guide/authentication/quick-start#python


@app.route('/oauth2callback', methods=['GET'])
def oauth2callback():
    platform = rcsdk.platform()
    auth_code = request.values.get('code')
    platform.login('', '', '', auth_code, RINGCENTRAL_REDIRECT_URL)
    tokens = platform.auth().data()
    session['sessionAccessToken'] = tokens
    return render_template('test.html')

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