PHP - oauth2 - necesito recibir el token de la api de abanca

 
Vista:

oauth2 - necesito recibir el token de la api de abanca

Publicado por alex (1 intervención) el 03/03/2021 16:57:22
Hola a todos,
Alguien me puede ayudar. necesito recibir el token de la api de abanca y me da error. Este es el codigo


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
$idcliente="xxxxx";
	$APIkey="xxxxxx";
	$code="22222222";
	$scope="3333";
	$url="https://api.abanca.com/sandbox/oauth2/token";
 
$parametros = [
    'grant_type' => 'authorization_code',
    'APLICACION' => $idcliente,
    'code'=>$code
];
 
 
 
$curl = curl_init();
 
		curl_setopt_array($curl, array(
		CURLOPT_URL => $url,
		CURLOPT_RETURNTRANSFER => true,
		CURLOPT_ENCODING => "",
		CURLOPT_MAXREDIRS => 10,
		CURLOPT_TIMEOUT => 30,
		CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
		CURLOPT_CUSTOMREQUEST => "POST",
		CURLOPT_POSTFIELDS => $parametros,
		CURLOPT_HTTPHEADER => array(
 
		"content-type: application/x-www-form-urlencoded",
		"AuthKey:" .$APIkey
  ),
));
 
$response = curl_exec($curl);
$err = curl_error($curl);
 
curl_close($curl);
 
if ($err) {
  echo "cURL Error #:" . $err;
} else {
echo "resultado <br><br>" ;
  echo $response;
}
echo('<br>');
 
 
?>

segun la banca este es el procedimiento
1
2
3
4
5
6
POST /oauth2/token HTTP/1.1
Host: {servidor api}
Content-Type: application/x-www-form-urlencoded
AuthKey: {api key}
grant_type=authorization_code
&APLICACION={id cliente}&code={authorization code}


me regresa este error

404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Mauro
Val: 2.761
Oro
Ha aumentado 1 puesto en PHP (en relación al último mes)
Gráfica de PHP

oauth2 - necesito recibir el token de la api de abanca

Publicado por Mauro (1034 intervenciones) el 23/03/2021 21:43:33
Hola Alex:

A juzgar por el error que te da pareciera ser que la URL está mal... ¿podrías validar eso?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar