How to automate OAuth token generation without browser intervention?

How to automate OAuth token generation without browser intervention?

Case 1

When you develop applications to source your own information, you won't have any proper redirection URLs. In that case, you can use Self Clients to get an authorization grant code. This one-time code can exchanged for an access token and a refresh token by making POST request to /oauth/v2/token.

Case 2

When you develop a web-server based application,
  1. You have to generate grant code using /oauth/v2/auth API.
  2. In /oauth/v2/auth by default, access_type will be online. Changing the parameter as access_type=offline will give refresh token along with the access token as a response for /oauth/v2/token.
  3. Save the created refresh token in your side. You can generate access tokens using refresh tokens
  4. Once the access token expires you can regenerate them using refresh tokens automatically.
 If you have deleted the refresh token, include access_type=offline in your authorization request. Adding prompt=consent along with access_type parameter prompts the OAuth page every time when your app tries to access user details.


    Zoho DataPrep Personalized Demo

    If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

    Zoho CRM Training

      Create, share, and deliver

      beautiful slides from anywhere.

      Get Started Now





              Zoho CRM Training Programs

              Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

              Zoho CRM Training

                  Zoho SalesIQ Resources



                      Zoho TeamInbox Resources




                                Zoho DataPrep Resources

                                  Zoho DataPrep Demo

                                  Get a personalized demo or POC

                                  REGISTER NOW


                                    Design. Discuss. Deliver.

                                    Create visually engaging stories with Zoho Show.

                                    Get Started Now











                                                          • Related Articles

                                                          • What to do when error occurred during access token generation?

                                                            The endpoint /oauth/v2/token supports only POST request. Request you hit directly from the browser is a GET request. Since token generation requests contain sensitive information like client secret and refresh tokens, GET request is not allowed. ...
                                                          • Asked to sign in to my account every time I quit my browser

                                                            What happened? If you sign in to your Zoho account once and mark your browser as the trusted browser, we won't ask you to verify your MFA mode for the next 30 days, even if you quit the browser. However, based on your browser settings or extensions, ...
                                                          • Why am I being asked for a verification code even after using my trusted browser?

                                                            Trusted browsers rely on information stored in the browser cookies. Your browser may be clearing cookies after you sign out of a session. Follow the steps given below to ensure you are not asked for a verification code even after using your trusted ...
                                                          • What is OAuth token and why should I migrate from Authtokens to it?

                                                            OAuth tokens are an industry standard protocol that are replacing old and obsolete authtokens. Unlike OAuth tokens which expire in one hour, authtokens will never expire unless you manually revoke them in your Zoho Accounts dashboard leading to many ...
                                                          • How to regenerate access token automatically?

                                                            You can regenerate access tokens automatically without prompting OAuth pages. The user has to grant access for the entire session to regenerate access tokens automatically. Learn more about how to generate access tokens without user consent in our ...

                                                          Resources

                                                          Videos

                                                          Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                          eBooks

                                                          Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                          Webinars

                                                          Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                          CRM Tips

                                                          Make the most of Zoho CRM with these useful tips.



                                                            Zoho Show Resources