Get the authentication page
Endpoint for calling the Excoinz Login window.
Request Syntax
POST /auth/login HTTP/1.1
Host: api.excoinz.com
EXCOINZ_SECRET: ${SECRET_KEY}
Content-Type: application/json
Request
Response
Sample
curl -X POST https://api.excoinz.com/auth/login \
-H "EXCOINZ_SECRET: ${SECRET_KEY}" \
-H "Content-Type: application/json" \
-d '{
"client_id": "YOUR_CLIENT_ID",
"locale": "YOUR_LOCALE",
"redirect_uri": "YOUR_REDIRECT_URI"
}'
const axios = require('axios');
const SECRET_KEY = 'YOUR_SECRET_KEY'; // Replace with your actual secret key
const requestData = {
client_id: 'YOUR_CLIENT_ID',
locale: 'YOUR_LOCALE',
redirect_uri: 'YOUR_REDIRECT_URI'
};
axios.post('https://api.excoinz.com/auth/login', requestData, {
headers: {
'EXCOINZ_SECRET': `${SECRET_KEY}`,
'Content-Type': 'application/json'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Error:', error);
});
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.util.HashMap;
import java.util.Map;
@Service
public class ExcoinzService {
private static final String ENDPOINT_URL = "https://api.excoinz.com/auth/login";
private static final String SECRET_KEY = "YOUR_SECRET_KEY"; // Replace with your actual secret key
public ResponseEntity<String> login() {
RestTemplate restTemplate = new RestTemplate();
// Setting headers
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("EXCOINZ_SECRET", SECRET_KEY);
// JSON body data
Map<String, Object> body = new HashMap<>();
body.put("client_id", "YOUR_CLIENT_ID");
body.put("locale", "YOUR_LOCALE");
body.put("redirect_uri", "YOUR_REDIRECT_URI");
// Create the request
HttpEntity<Map<String, Object>> entity = new HttpEntity<>(body, headers);
// Execute the request
ResponseEntity<String> response = restTemplate.exchange(ENDPOINT_URL, HttpMethod.POST, entity, String.class);
return response;
}
}
<?php
$url = 'https://api.excoinz.com/auth/login';
$SECRET_KEY = 'YOUR_SECRET_KEY';
$client_id = 'YOUR_CLIENT_ID';
$locale = 'YOUR_LOCALE';
$redirect_uri = 'YOUR_REDIRECT_URI';
$headers = array(
"EXCOINZ_SECRET: $SECRET_KEY",
"Content-Type: application/json"
);
$data = array(
"client_id" => $client_id,
"locale" => $locale,
"redirect_uri" => $redirect_uri
);
// Initialize cURL session
$ch = curl_init($url);
// Set cURL options
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); // Convert array to JSON
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute cURL session and get the response
$response = curl_exec($ch);
// Check for cURL errors
if ($error = curl_error($ch)) {
die('cURL error: ' . $error);
}
// Close the cURL session
curl_close($ch);
// Print the response
echo $response;
?>
Last updated