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
Text Automation
Tags: sms and text messaging
Feb 2, 2017 at 4:39pm   •   6 replies  •  0 likes
grant-botma

I built a private app for a client about a year ago that allows him to set up HTTP posts throughout sales campaign sequences in his CRM that automate text messages from his team to clients. I'm wondering if this would be possible in a public application. Since the password auth flow isn't available in public applications, is there any way to re-authenticate a client in the background? The only way I can think of would be to encrypt and store a token (not ideal) and then re-use it when a request is made to our server. This would still require users to log in and obtain a new token on a regular basis, which detracts from the 'automation' appeal. If storing and reusing access tokens is what you'd recommend, what is the max that the 'refresh_token_expires_in' value can be set to?


Just double checking - a private application can only send messages from the account it was built for, correct?

6 Answers
answered on Feb 3, 2017 at 5:05pm  
Dean is correct. You can use the refresh token flow to refresh the token on a regular basis(to obtain a new refresh token before it expires). Each user only need to authorize your app once and only once.

 0
answered on Feb 3, 2017 at 4:19pm  
Hello Grant,

Using the Authorization Flow (3-Legged OAuth), your application code can enable customers to authorize an application to act on their behalf. Once a user has granted your application permission to do this, the Redirect URL of your application will receive a request with a "code" which your application then uses to obtain a valid "access_token" for that user (it also will have a refresh token). Here are some Authorization Flow implementation examples in multiple languages: https://github.com/grokify/ringcentral-demos-oauth (you can also find these organized by programming language on the RingCentral Developer Portal SDK page).

Your code should cache the access_token and refresh_token, and then set a timer based on the refresh_token_ttl (the length of time to live for the until the refresh token expires).

Your application code should use the refresh token flow, when one of the following occurs:

1. Your access_token has expired, and the refresh_token is still valid (this is typically done while the user-session is still active).

2. When 80% of the refresh_token_ttl seconds have expired (this way your application still has 20% of the TTL seconds available in cases where there is a non-HTTP-200 response received while attempting to refresh your refresh token (this is typically done for long-running processes or service-workers such as what you've described for your use case).

The reason that RingCentral prohibits Password Flow on Public applications is because when a developer indicates an application will be public, that application has the ability to be installed in RingCentral accounts which are NOT part of your organization (which means that your API keys will be invalid for use while attempting to obtain an access_token) and because otherwise you would be required to store RingCentral usernames/passwords in your database(s) and this is a security risk we do not want you to be responsible for owning, and which we do not want to expose upon our users.

 0
answered on Feb 3, 2017 at 9:45am  
So is there another way to authenticate a client or retrieve a new auth token in the background so users won't need to enter their credentials on a regular basis?

 0
answered on Feb 2, 2017 at 11:07pm  
Hi, I just checked and I think you are right. Public app does NOT support password flow. I was not aware of this limitation before.

 0
answered on Feb 2, 2017 at 6:55pm  
I don't think so. Where did you get this information?
I don't see it anywhere in the docs, but when creating a new app, the Authorization Flows that appear when 'Public' is selected don't include password flow, no matter the platform type. Also, I tried authenticating via password flow in a public application and received an error message letting me know that I was unable to authenticate using that method. Should I be able to use password flow in a public application? Do you know how I could enable that functionality?

 0
answered on Feb 2, 2017 at 5:44pm  
Since the password auth flow isn't available in public applications

I don't think so. Where did you get this information?


what is the max that the 'refresh_token_expires_in' value can be set to?

A week, or 604800 seconds. 


a private application can only send messages from the account it was built for
Private apps will be available for the users belonging to your RingCentral account only. Public apps will be available for users from other RingCentral accounts as well.

 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