Skip to content

Latest commit

 

History

History
198 lines (151 loc) · 5.93 KB

OAuthApi.md

File metadata and controls

198 lines (151 loc) · 5.93 KB

Dropbox.Sign.Api.OAuthApi

All URIs are relative to https://api.hellosign.com/v3

Method HTTP request Description
OauthTokenGenerate POST /oauth/token OAuth Token Generate
OauthTokenRefresh POST /oauth/token?refresh OAuth Token Refresh

OauthTokenGenerate

OAuthTokenResponse OauthTokenGenerate (OAuthTokenGenerateRequest oAuthTokenGenerateRequest)

OAuth Token Generate

Once you have retrieved the code from the user callback, you will need to exchange it for an access token via a backend call.

Example

using System;
using System.Collections.Generic;
using System.IO;
using Dropbox.Sign.Api;
using Dropbox.Sign.Client;
using Dropbox.Sign.Model;

public class Example
{
    public static void Main()
    {
        var config = new Configuration();

        var oAuthApi = new OAuthApi(config);

        var data = new OAuthTokenGenerateRequest(
            state: "900e06e2",
            code: "1b0d28d90c86c141",
            clientId: "cc91c61d00f8bb2ece1428035716b",
            clientSecret: "1d14434088507ffa390e6f5528465"
        );

        try
        {
            var result = oAuthApi.OauthTokenGenerate(data);
            Console.WriteLine(result);
        }
        catch (ApiException e)
        {
            Console.WriteLine("Exception when calling Dropbox Sign API: " + e.Message);
            Console.WriteLine("Status Code: " + e.ErrorCode);
            Console.WriteLine(e.StackTrace);
        }
    }
}

Using the OauthTokenGenerateWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // OAuth Token Generate
    ApiResponse<OAuthTokenResponse> response = apiInstance.OauthTokenGenerateWithHttpInfo(oAuthTokenGenerateRequest);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling OAuthApi.OauthTokenGenerateWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
oAuthTokenGenerateRequest OAuthTokenGenerateRequest

Return type

OAuthTokenResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

OauthTokenRefresh

OAuthTokenResponse OauthTokenRefresh (OAuthTokenRefreshRequest oAuthTokenRefreshRequest)

OAuth Token Refresh

Access tokens are only valid for a given period of time (typically one hour) for security reasons. Whenever acquiring an new access token its TTL is also given (see expires_in), along with a refresh token that can be used to acquire a new access token after the current one has expired.

Example

using System;
using System.Collections.Generic;
using System.IO;
using Dropbox.Sign.Api;
using Dropbox.Sign.Client;
using Dropbox.Sign.Model;

public class Example
{
    public static void Main()
    {
        var config = new Configuration();

        var oAuthApi = new OAuthApi(config);

        var data = new OAuthTokenRefreshRequest(
            refreshToken: "hNTI2MTFmM2VmZDQxZTZjOWRmZmFjZmVmMGMyNGFjMzI2MGI5YzgzNmE3"
        );

        try
        {
            var result = oAuthApi.OauthTokenRefresh(data);
            Console.WriteLine(result);
        }
        catch (ApiException e)
        {
            Console.WriteLine("Exception when calling Dropbox Sign API: " + e.Message);
            Console.WriteLine("Status Code: " + e.ErrorCode);
            Console.WriteLine(e.StackTrace);
        }
    }
}

Using the OauthTokenRefreshWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // OAuth Token Refresh
    ApiResponse<OAuthTokenResponse> response = apiInstance.OauthTokenRefreshWithHttpInfo(oAuthTokenRefreshRequest);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling OAuthApi.OauthTokenRefreshWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
oAuthTokenRefreshRequest OAuthTokenRefreshRequest

Return type

OAuthTokenResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -

[Back to top] [Back to API list] [Back to Model list] [Back to README]