News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
Best Practices With OAuth and Multiple Processes
Tags: oauth, oauth2
Apr 27, 2020 at 2:30pm   •   2 replies  •  0 likes
matt-spinks

I'm looking for some guidance on how to handle multiple backend processes attempting to access the RingCentral api for the same account simultaneously. Each separate process runs independently, on a separate schedule, and has its own token refresh logic built in. For the most part, this all works well. But every once in a while I end up with a token that is "expired". The only way to resolve it is to have the user log back into our app so the token can refresh again.

This happens very infrequently, but often enough that it's an annoyance both to me and to the customers impacted. But it's infrequent enough that it's hard to track down the issue. I am suspicious that my two separate processes are colliding with each other, getting fired off at the same time, and the refreshed token in one process overrides the refreshed token in the other one, and the system ends up with an invalid token at the end. Is that a possibility?

What is the best way to handle this scenario?

Just a little background - the two processes run continuously, on separate schedules, and check the user's account for new data. One process runs every 5 minutes, and the other process runs every 2 minutes.

2 Answers
answered on Apr 29, 2020 at 2:14pm  

One way I can suggest is sharing the access token among multiple backend process. If you are using API calls in backend process with access token, which I am assuming, you can share that with the multiple calls. One of the way is using Caching the token for a particular period of time and using the token among different processes.

That will avoid colliding and overriding issue you are facing


 0
answered on Apr 29, 2020 at 10:13am  

Hi Matt,

Sorry for the delayed response. Are you looking for solutions for password flow or OAuth authentication? There must be different approach for different authentication method. So let me know.


 0



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

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us