Skip to content

Latest commit

 

History

History
284 lines (197 loc) · 7.55 KB

LoginApi.md

File metadata and controls

284 lines (197 loc) · 7.55 KB

VeloPayments::LoginApi

All URIs are relative to https://api.sandbox.velopayments.com

Method HTTP request Description
logout POST /v1/logout Logout
reset_password POST /v1/password/reset Reset password
validate_access_token POST /v1/validate validate
velo_auth POST /v1/authenticate Authentication endpoint

logout

logout

Logout

Given a valid access token in the header then log out the authenticated user or client

Will revoke the token

Examples

require 'time'
require 'velopayments'
# setup authorization
VeloPayments.configure do |config|
  # Configure OAuth2 access token for authorization: OAuth2
  config.access_token = 'YOUR ACCESS TOKEN'
end

api_instance = VeloPayments::LoginApi.new

begin
  # Logout
  api_instance.logout
rescue VeloPayments::ApiError => e
  puts "Error when calling LoginApi->logout: #{e}"
end

Using the logout_with_http_info variant

This returns an Array which contains the response data (nil in this case), status code and headers.

<Array(nil, Integer, Hash)> logout_with_http_info

begin
  # Logout
  data, status_code, headers = api_instance.logout_with_http_info
  p status_code # => 2xx
  p headers # => { ... }
  p data # => nil
rescue VeloPayments::ApiError => e
  puts "Error when calling LoginApi->logout_with_http_info: #{e}"
end

Parameters

This endpoint does not need any parameter.

Return type

nil (empty response body)

Authorization

OAuth2

HTTP request headers

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

reset_password

reset_password(reset_password_request)

Reset password

Reset password

An email with an embedded link will be sent to the receipient of the email address

The link will contain a token to be used for resetting the password

Examples

require 'time'
require 'velopayments'

api_instance = VeloPayments::LoginApi.new
reset_password_request = VeloPayments::ResetPasswordRequest.new({email: 'foo@example.com'}) # ResetPasswordRequest | An Email address to send the reset password link to

begin
  # Reset password
  api_instance.reset_password(reset_password_request)
rescue VeloPayments::ApiError => e
  puts "Error when calling LoginApi->reset_password: #{e}"
end

Using the reset_password_with_http_info variant

This returns an Array which contains the response data (nil in this case), status code and headers.

<Array(nil, Integer, Hash)> reset_password_with_http_info(reset_password_request)

begin
  # Reset password
  data, status_code, headers = api_instance.reset_password_with_http_info(reset_password_request)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => nil
rescue VeloPayments::ApiError => e
  puts "Error when calling LoginApi->reset_password_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
reset_password_request ResetPasswordRequest An Email address to send the reset password link to

Return type

nil (empty response body)

Authorization

No authorization required

HTTP request headers

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

validate_access_token

validate_access_token(access_token_validation_request, opts)

validate

The second part of login involves validating using an MFA device

An access token with PRE_AUTH authorities is required

Examples

require 'time'
require 'velopayments'
# setup authorization
VeloPayments.configure do |config|
  # Configure OAuth2 access token for authorization: OAuth2
  config.access_token = 'YOUR ACCESS TOKEN'
end

api_instance = VeloPayments::LoginApi.new
access_token_validation_request = VeloPayments::AccessTokenValidationRequest.new({otp: '123456'}) # AccessTokenValidationRequest | An OTP from the user's registered MFA Device 
opts = {
  authorization: 'authorization_example' # String | Bearer token authorization leg of validate
}

begin
  # validate
  result = api_instance.validate_access_token(access_token_validation_request, opts)
  p result
rescue VeloPayments::ApiError => e
  puts "Error when calling LoginApi->validate_access_token: #{e}"
end

Using the validate_access_token_with_http_info variant

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

<Array(, Integer, Hash)> validate_access_token_with_http_info(access_token_validation_request, opts)

begin
  # validate
  data, status_code, headers = api_instance.validate_access_token_with_http_info(access_token_validation_request, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <AccessTokenResponse>
rescue VeloPayments::ApiError => e
  puts "Error when calling LoginApi->validate_access_token_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
access_token_validation_request AccessTokenValidationRequest An OTP from the user's registered MFA Device
authorization String Bearer token authorization leg of validate [optional]

Return type

AccessTokenResponse

Authorization

OAuth2

HTTP request headers

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

velo_auth

velo_auth(opts)

Authentication endpoint

Use this endpoint to obtain an access token for calling Velo Payments APIs. Use HTTP Basic Auth. String value of Basic and a Base64 endcoded string comprising the API key (e.g. 44a9537d-d55d-4b47-8082-14061c2bcdd8) and API secret (e.g. c396b26b-137a-44fd-87f5-34631f8fd529) with a colon between them. E.g. Basic 44a9537d-d55d-4b47-8082-14061c2bcdd8:c396b26b-137a-44fd-87f5-34631f8fd529

Examples

require 'time'
require 'velopayments'
# setup authorization
VeloPayments.configure do |config|
  # Configure HTTP basic authorization: basicAuth
  config.username = 'YOUR USERNAME'
  config.password = 'YOUR PASSWORD'
end

api_instance = VeloPayments::LoginApi.new
opts = {
  grant_type: 'grant_type_example' # String | OAuth grant type. Should use 'client_credentials'
}

begin
  # Authentication endpoint
  result = api_instance.velo_auth(opts)
  p result
rescue VeloPayments::ApiError => e
  puts "Error when calling LoginApi->velo_auth: #{e}"
end

Using the velo_auth_with_http_info variant

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

<Array(, Integer, Hash)> velo_auth_with_http_info(opts)

begin
  # Authentication endpoint
  data, status_code, headers = api_instance.velo_auth_with_http_info(opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <AuthResponse>
rescue VeloPayments::ApiError => e
  puts "Error when calling LoginApi->velo_auth_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
grant_type String OAuth grant type. Should use 'client_credentials' [optional][default to 'client_credentials']

Return type

AuthResponse

Authorization

basicAuth

HTTP request headers

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