Skip to content

Latest commit

 

History

History
168 lines (110 loc) · 5.26 KB

File metadata and controls

168 lines (110 loc) · 5.26 KB

SunshineConversationsClient::OAuthEndpointsApi

All URIs are relative to https://api.smooch.io

Method HTTP request Description
authorize GET /oauth/authorize Authorize
get_token POST /oauth/token Get Token
revoke_access DELETE /oauth/authorization Revoke Access

authorize

authorize(client_id, response_type, opts)

Authorize

This endpoint begins the OAuth flow. It relies on a browser session for authentication. If the user is not logged in to Sunshine Conversations they will be redirected to the login page. If the user has many apps, they will first be prompted to select the one they wish to integrate with. They will then be presented with an Allow/Deny dialog, describing details of the access your integration is requesting.

Example

# load the gem
require 'sunshine-conversations-client'

api_instance = SunshineConversationsClient::OAuthEndpointsApi.new
client_id = '5e4af71a81966cfff3ef6550' # String | Your integration’s unique identifier
response_type = 'code' # String | For now the only acceptable value is code.
# Be sure to add the required body parameters
opts = {
  state: 'Pending', # String | You may pass in any arbitrary string value here which will be returned to you along with the code via browser redirect.
  redirect_uri: 'https://example.org' # String | You may pass in a redirect_uri to determine which URI the response is redirected to. This URI must be contained in the list configured by your integration. If this option is not passed, the first URI present in the list will be used.
}

begin
  #Authorize
  api_instance.authorize(client_id, response_type, opts)
rescue SunshineConversationsClient::ApiError => e
  puts "Exception when calling OAuthEndpointsApi->authorize: #{e}"
end

Parameters

Name Type Description Notes
client_id String Your integration’s unique identifier
response_type String For now the only acceptable value is code.
state String You may pass in any arbitrary string value here which will be returned to you along with the code via browser redirect. [optional]
redirect_uri String You may pass in a redirect_uri to determine which URI the response is redirected to. This URI must be contained in the list configured by your integration. If this option is not passed, the first URI present in the list will be used. [optional]

Return type

nil (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

get_token

Object get_token(inline_object)

Get Token

This endpoint is used to exchange an authorization code for an access token. It should only be used in server-to-server calls.

Example

# load the gem
require 'sunshine-conversations-client'

api_instance = SunshineConversationsClient::OAuthEndpointsApi.new
inline_object = SunshineConversationsClient::InlineObject.new # InlineObject | 
# Be sure to add the required body parameters

begin
  #Get Token
  result = api_instance.get_token(inline_object)
  p result
rescue SunshineConversationsClient::ApiError => e
  puts "Exception when calling OAuthEndpointsApi->get_token: #{e}"
end

Parameters

Name Type Description Notes
inline_object InlineObject

Return type

Object

Authorization

No authorization required

HTTP request headers

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

revoke_access

Object revoke_access

Revoke Access

This endpoint is used to revoke your integration’s access to the user’s Sunshine Conversations app. Revoking access means your integration will no longer be able to interact with the app, and any webhooks the integration had previously configured will be removed. Calling this endpoint is equivalent to the user removing your integration manually in the Sunshine Conversations web app. Your integration’s removeUrl (if configured) will also be called when an integration is removed in this way.

Example

# load the gem
require 'sunshine-conversations-client'
# setup authorization
SunshineConversationsClient.configure do |config|
  # Configure HTTP basic authorization: basicAuth
  config.username = 'YOUR_USERNAME'
  config.password = 'YOUR_PASSWORD'

  # Configure Bearer authorization (JWT): bearerAuth
  # Uncomment this line to use JWTs
  # config.access_token = 'YOUR_JWT'
end

api_instance = SunshineConversationsClient::OAuthEndpointsApi.new
# Be sure to add the required body parameters

begin
  #Revoke Access
  result = api_instance.revoke_access
  p result
rescue SunshineConversationsClient::ApiError => e
  puts "Exception when calling OAuthEndpointsApi->revoke_access: #{e}"
end

Parameters

This endpoint does not need any parameter.

Return type

Object

Authorization

basicAuth, bearerAuth

HTTP request headers

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