Autenticación de API
Aprende cómo realizar la autenticación vía API en la plataforma de Genius Referrals, ofrecemos dos métodos de autenticación para consumir nuestra API: WSSE y X-Auth-Token. Ambos métodos proporcionan formas seguras de autenticar solicitudes.
Requisitos Previos
Nota: Para usar la autenticación WSSE, debes incluir el encabezado X-WSSE en tu solicitud.
Solicitud:
# Testing Authentication
curl -v -H 'Accept: application/json' -H 'Content-type: application/json' -H 'X-WSSE: UsernameToken Username="test@geniusreferrals.com", PasswordDigest="oCKMP/2zpOOikGksjBcNS3kSd9c=", Nonce="09579a3b30e86b94d887c037b76476baf1bf2519", Created="2014-06-06T20:12:52+00:00"' -X GET https://api.geniusreferrals.com/test-authentication
Respuesta:
GET /test-authentication HTTP/1.1
User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
Host: api.geniusreferrals.com
Accept: application/json
Content-type: application/json
X-WSSE: UsernameToken Username="test@geniusreferrals.com", PasswordDigest="oCKMP/2zpOOikGksjBcNS3kSd9c=", Nonce="09579a3b30e86b94d887c037b76476baf1bf2519", Created="2014-06-06T20:12:52+00:00"
HTTP/1.1 200 OK
Date: Mon, 19 May 2014 18:45:58 GMT
Server: Apache/2.2.16 (Debian)
Cache-Control: no-cache
Access-Control-Allow-Origin: *
Allow: GET, OPTIONS
X-Debug-Token: 9a49db
Transfer-Encoding: chunked
Content-Type: application/json
* Connection #0 to host api.geniusreferrals.com left intact
* Closing connection #0
{
"code":200,
"message":"Hello test@geniusreferrals.com!, You've successfully authenticated on Genius Referrals platform."
}
Solicitud:
# X-Auth-Token Authentication
curl -X GET -H 'Accept: application/json' -H 'Content-type: application/json' -H 'X-Auth-Token: 828475d245e6ac4e18bb998ccd3d089956669ca0' https://api.geniusreferrals.com/test-authentication
Respuesta:
GET /test-authentication HTTP/1.1
User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
Host: api.geniusreferrals.com
Accept: application/json
Content-type: application/json
X-Auth-Token: 828475d245e6ac4e18bb998ccd3d089956669ca0
HTTP/1.1 200 OK
Date: Mon, 19 May 2014 18:45:58 GMT
Server: Apache/2.2.16 (Debian)
Cache-Control: no-cache
Access-Control-Allow-Origin: *
Allow: GET, OPTIONS
X-Debug-Token: 9a49db
Transfer-Encoding: chunked
Content-Type: application/json
{
"code":200,
"message":"Hello user!, You've successfully authenticated using X-Auth-Token on the Genius Referrals platform."
}