production
development
https://sandboxapi.rakbank.ae/sb/api
Paths
/int_client_auth/token
post /int_client_auth/token
Request Access Tokens
This endpoint allows requesting an access token following the Client Credentials (there isnt resource owner information) flow below:
- Confidential clients should authenticate using HTTP Basic Authentication.
grant_type
Required in formData
string
Type of grant
{
"enum": [
"authorization_code",
"password",
"client_credentials",
"refresh_token"
]
}
client_id
Optional in formData
string
Application client ID, can be provided in formData or using HTTP Basic Authentication
client_secret
Optional in formData
string
Application secret, must be provided in formData or using HTTP Basic Authentication
scope
Required in formData
string
Scope being requested
Content-Type
Optional in header
string
application/x-www-form-urlencoded
Accept
Optional in header
string
application/json
200
json document containing token, etc.
400
json document that may contain additional details about the failure
Example Request
curl --request POST \
--url https://sandboxapi.rakbank.ae/sb/api/v1/int_client_auth/token \
--header 'accept: application/json' \
--header 'content-type: application/x-www-form-urlencoded' \
--data 'grant_type=client_credentials&client_id=4458164265156608&client_secret=ojunovgusoln&scope=niivpovagacugreb'
require 'uri'
require 'openssl'
require 'net/http'
url = URI("https://sandboxapi.rakbank.ae/sb/api/v1/int_client_auth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/x-www-form-urlencoded'
request["accept"] = 'application/json'
request.body = "grant_type=client_credentials&client_id=4458164265156608&client_secret=ojunovgusoln&scope=niivpovagacugreb"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("sandboxapi.rakbank.ae")
payload = "grant_type=client_credentials&client_id=4458164265156608&client_secret=ojunovgusoln&scope=niivpovagacugreb"
headers = {
'content-type': "application/x-www-form-urlencoded",
'accept': "application/json"
}
conn.request("POST", "/sb/api/v1/int_client_auth/token", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandboxapi.rakbank.ae/sb/api/v1/int_client_auth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "grant_type=client_credentials&client_id=4458164265156608&client_secret=ojunovgusoln&scope=niivpovagacugreb",
CURLOPT_HTTPHEADER => array(
"accept: application/json",
"content-type: application/x-www-form-urlencoded"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
// OkHttpClient from http://square.github.io/okhttp/
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "grant_type=client_credentials&client_id=4458164265156608&client_secret=ojunovgusoln&scope=niivpovagacugreb");
Request request = new Request.Builder()
.url("https://sandboxapi.rakbank.ae/sb/api/v1/int_client_auth/token")
.post(body)
.addHeader("content-type", "application/x-www-form-urlencoded")
.addHeader("accept", "application/json")
.build();
Response response = client.newCall(request).execute();
// Install request by running "npm install --save request"
var request = require("request");
var options = { method: 'POST',
url: 'https://sandboxapi.rakbank.ae/sb/api/v1/int_client_auth/token',
headers:
{ accept: 'application/json',
'content-type': 'application/x-www-form-urlencoded' },
form:
{ grant_type: 'client_credentials',
client_id: '4458164265156608',
client_secret: 'ojunovgusoln',
scope: 'niivpovagacugreb' } };
request(options, function (error, response, body) {
if (error) return console.error('Failed: %s', error.message);
console.log('Success: ', body);
});
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://sandboxapi.rakbank.ae/sb/api/v1/int_client_auth/token"
payload := strings.NewReader("grant_type=client_credentials&client_id=4458164265156608&client_secret=ojunovgusoln&scope=niivpovagacugreb")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/x-www-form-urlencoded")
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
import Foundation
let headers = [
"content-type": "application/x-www-form-urlencoded",
"accept": "application/json"
]
var postData = NSMutableData(data: "grant_type=client_credentials".dataUsingEncoding(NSUTF8StringEncoding)!)
postData.appendData("&client_id=4458164265156608".dataUsingEncoding(NSUTF8StringEncoding)!)
postData.appendData("&client_secret=ojunovgusoln".dataUsingEncoding(NSUTF8StringEncoding)!)
postData.appendData("&scope=niivpovagacugreb".dataUsingEncoding(NSUTF8StringEncoding)!)
var request = NSMutableURLRequest(URL: NSURL(string: "https://sandboxapi.rakbank.ae/sb/api/v1/int_client_auth/token")!,
cachePolicy: .UseProtocolCachePolicy,
timeoutInterval: 10.0)
request.HTTPMethod = "POST"
request.allHTTPHeaderFields = headers
request.HTTPBody = postData
let session = NSURLSession.sharedSession()
let dataTask = session.dataTaskWithRequest(request, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error)
} else {
let httpResponse = response as? NSHTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
Example Response
POST https://sandboxapi.rakbank.ae/sb/api/v1/int_client_auth/token
{
"token_type": "bearer",
"access_token": "6304235636977193",
"expires_in": 99992564,
"scope": "hedodosjotgeze",
"refresh_token": "830c08bc7dc069fce246a9589d3a2773601155da3723a0c601b82a08bedc434d"
}
Try this operation
No response. This is a mixed content call. It is not possible to test HTTP APIs from an HTTPS secured Portal site and vice versa.
No response. This is a cross-origin call. Make sure the server accepts requests from this portal. Or if using self-signed SSL certificates then paste the URL above into your browser to accept the certificate before trying again (On Internet Explorer it must be the same browser tab.).
Definitions
{
"type": "object",
"additionalProperties": false,
"required": [
"token_type",
"access_token",
"expires_in"
],
"properties": {
"token_type": {
"enum": [
"bearer"
]
},
"access_token": {
"type": "string"
},
"expires_in": {
"type": "integer"
},
"scope": {
"type": "string"
},
"refresh_token": {
"type": "string"
}
}
}