第 3 步:创建访问令牌和刷新令牌

    您通过 OAuth2.0 发出的 API 请求通常用 access_token 进行身份验证,它作为持有者令牌进行传递。

    为了使用此 access_token,您需要构造常规 HTTP 请求,将其与持有者的值一同包含在授权标头中。

    请注意,"access_token" 将在 1 小时内到期。

    请求参数

    现在使用以下参数对您自己进行授权:

    参数数据类型描述
    必需参数
    grant_type字符串输入 grant_type = authorization_code
    client_id字符串Zoho 开发者控制台中找到的 client_id。
    client_secret字符串Zoho 开发者控制台中找到的 client_secret。
    redirect_uri字符串指定在应用程序注册期间所提供的回调 URL
    response_type字符串输入 response_type 为 code
    可选参数
    access_type字符串指定 access_typeonlineoffline
    如果您要生成 refresh_token,请将 access_type 值设为 offline

    
    				To generate access_token, do the following:
    
    1. Make a POST request with the following URL: 
    
    https://accounts.zoho.com/oauth/v2/token?
    code={grant_token}&=https://www.zoho.com/&client_id={client_id}
    &client_secret={client_secret}
    &grant_type=authorization_code
    
    2. On successful request, you will receive the following:
    
     
    
    {
       "access_token" : "{access_token}",
      "refresh_token" : "{refresh_token}",
      "expires_in_sec": 3600,
       "api_domain" : "https://writer.zoho.com" ,
      "token_type" : "Bearer",
      "expires_in" : 3600000
     }
    
    This completes the authorization process. Once your app receives the access_token, send it via the HTTP authorization header to Writer's API with value as "Zoho-oauthtoken {access_token}" for each endpoint.