Skip to content

Latest commit

 

History

History
124 lines (84 loc) · 4.45 KB

OauthApi.md

File metadata and controls

124 lines (84 loc) · 4.45 KB

UltraCartRestApiV2.OauthApi

All URIs are relative to https://secure.ultracart.com/rest/v2

Method HTTP request Description
oauthAccessToken POST /oauth/token Exchange authorization code for access token.
oauthRevoke POST /oauth/revoke Revoke this OAuth application.

oauthAccessToken

OauthTokenResponse oauthAccessToken(client_id, grant_type, opts)

Exchange authorization code for access token.

The final leg in the OAuth process which exchanges the specified access token for the access code needed to make API calls.

Example

var UltraCartRestApiV2 = require('ultra_cart_rest_api_v2');

// Create a Simple Key: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/38688545/API+Simple+Key
var simpleKey = "109ee846ee69f50177018ab12f008a00748a25aa28dbdc0177018ab12f008a00";
UltraCartRestApiV2.ApiClient.usingApiKey(simpleKey, false)
var apiInstance = new UltraCartRestApiV2.OauthApi();


var client_id = "client_id_example"; // String | The OAuth application client_id.

var grant_type = "grant_type_example"; // String | Type of grant

var opts = { 
  'code': "code_example", // String | Authorization code received back from the browser redirect
  'redirect_uri': "redirect_uri_example", // String | The URI that you redirect the browser to to start the authorization process
  'refresh_token': "refresh_token_example" // String | The refresh token received during the original grant_type=authorization_code that can be used to return a new access token
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.oauthAccessToken(client_id, grant_type, opts, callback);

Parameters

Name Type Description Notes
client_id String The OAuth application client_id.
grant_type String Type of grant
code String Authorization code received back from the browser redirect [optional]
redirect_uri String The URI that you redirect the browser to to start the authorization process [optional]
refresh_token String The refresh token received during the original grant_type=authorization_code that can be used to return a new access token [optional]

Return type

OauthTokenResponse

Authorization

ultraCartBrowserApiKey, ultraCartOauth, ultraCartSimpleApiKey

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded
  • Accept: application/json

oauthRevoke

OauthRevokeSuccessResponse oauthRevoke(client_id, token)

Revoke this OAuth application.

Revokes the OAuth application associated with the specified client_id and token.

Example

var UltraCartRestApiV2 = require('ultra_cart_rest_api_v2');

// Create a Simple Key: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/38688545/API+Simple+Key
var simpleKey = "109ee846ee69f50177018ab12f008a00748a25aa28dbdc0177018ab12f008a00";
UltraCartRestApiV2.ApiClient.usingApiKey(simpleKey, false)
var apiInstance = new UltraCartRestApiV2.OauthApi();


var client_id = "client_id_example"; // String | The OAuth application client_id.

var token = "token_example"; // String | The OAuth access token that is to be revoked..


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.oauthRevoke(client_id, token, callback);

Parameters

Name Type Description Notes
client_id String The OAuth application client_id.
token String The OAuth access token that is to be revoked..

Return type

OauthRevokeSuccessResponse

Authorization

ultraCartBrowserApiKey, ultraCartOauth, ultraCartSimpleApiKey

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded
  • Accept: application/json