Search code examples
access-tokenzoho

How to get Access Token for Client Based Application for Zoho API?


Does this mean Zoho API documentations are wrong? I'm following the "client based applications" as my app is a ReactJS based app. Unfortuantely im getting a fetch failed type of error when trying to request an authentication token using response_type = token.

Very frustrating indeed.

What is the proper way to get an auth token for ReactJs apps?


Solution

  • You can get it by chrome(or firefox)

    Get format (make single line)

    https://accounts.zoho.com/oauth/v2/auth?
    client_id={your client id}&
    response_type=token&
    scope=AaaServer.profile.Read&
    redirect_uri={your app redirect URI}
    

    This is steps

    1. Get client_id and redirect_uri from my Zoho Setting
    https://api-console.zoho.com/
    

    enter image description here enter image description here

    1. Make single line string with upper format put that string and enter from Chrome The client id and redirect URI should be match your App settings.

    enter image description here

    Click the Accept button with checked Grant access checkbox

    enter image description here

    Will get the access token at address editor in Chrome

    enter image description here

    1. Get new access token with this format
    http://localhost:3000/#&
    access_token={get-new-access-token}&
    expires_in=3600&
    location=us&
    api_domain=https%3A%2F%2Fwww.zohoapis.com&
    granted_for_session=true
    

    You can make your React app for getting access token with this steps.