Basic Authentication (DEPRECATED - DO NOT USE)

NOTE: Basic Authentication is now deprecated. Please use OAuth2 client credential flows.

Assembly Payments APIs implement basic authentication. Clients are required to send HTTP requests with the Authorization header that contains the word Basic followed by a space and a base64-encoded string username:password. For example, to authorize as username: demo and password: [email protected] the client would send

Authorization: Basic ZGVtbzpwQDU1dzByZA==

The following code examples show the client code used to call the list users API with the dummy authorization header values above

curl -X GET \
  https://test.api.promisepay.com/users \
  --header 'accept: application/json' \
  --header 'Authorization: Basic ZGVtbzpwQDU1dzByZA=='
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://test.api.promisepay.com/users?limit=10&offset=0&search=search")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["Authorization"] = 'Basic ZGVtbzpwQDU1dzByZA=='

response = http.request(request)
puts response.read_body
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://test.api.promisepay.com/users?limit=10&offset=0&search=search",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "Authorization: Basic ZGVtbzpwQDU1dzByZA=="
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
var data = null;

var xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://test.api.promisepay.com/users?limit=10&offset=0&search=search");
xhr.setRequestHeader("accept", "application/json");
xhr.setRequestHeader("Authorization", "Basic ZGVtbzpwQDU1dzByZA==");

xhr.send(data);
var client = new RestClient("https://test.api.promisepay.com/users?limit=10&offset=0&search=search");
var request = new RestRequest(Method.GET);
request.AddHeader("accept", "application/json");
request.AddHeader("Authorization", "Basic ZGVtbzpwQDU1dzByZA==");
IRestResponse response = client.Execute(request);
package main

import (
    "fmt"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://test.api.promisepay.com/users?limit=10&offset=0&search=search"

    req, _ := http.NewRequest("GET", url, nil)

    req.Header.Add("accept", "application/json")
    req.Header.Add("Authorization", "Basic ZGVtbzpwQDU1dzByZA==")
    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}

Note: The auto generated code examples for this section of the documentation of all the APIs does not include the basic authentication header values so please remember to add them for all API calls your client plans to execute