Bonjour à tous,

Pourriez vous m'aider s'il vous plaît?
J’essaie d'utiliser cette api https://api.ibanfirst.com/APIDocumen...tAPI/Security/ avec le wsse.
Par contre j'ai toujours en retour
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
{
  "errors": "HTTP\/2 400  returned for \"https:\/\/sandbox2.ibanfirst.com\/api\/wallets\"."
}

J'ai bien les bon identifiants, mais sur l'api il-y a l'indication
All API request must be made over HTTPS. Calls made over plain HTTP will fail. You must authenticate for all requests.
ça veut dire que le client doit-être en https? Du coup je peux tester comment en local d'après vous?

J'utilise symfony et le httpclient.
Ma classe
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
 
namespace App\Api;
 
use App\Exception\IbanFirstApiException;
use Symfony\Contracts\HttpClient\HttpClientInterface;
 
class IbanFirstApi
{ 
    private $client;
    private $apiIbanFirstUrl;
    private $headerAuthentification;
 
    public function __construct(
        string $apiIbanFirstUrl,
        string $apiIbanFirsLogin,
        string $apiIbanFirstPass,
        HttpClientInterface $client
    )
    {
        $this->client = $client;
        $this->apiIbanFirstUrl = $apiIbanFirstUrl;
        $this->headerAuthentification($apiIbanFirsLogin, $apiIbanFirstPass);
    }
 
    public function wallets() : array
    {
        $response = $this->client->request(
            'GET',
            $this->apiIbanFirstUrl . '/wallets',
            $this->headerAuthentification
        );
 
        $this->validatorResponse($response);
 
        return $response->toArray();
    }
 
    public function financialMovements() : array
    {
        $response = $this->client->request(
            'GET',
            $this->apiIbanFirstUrl . '/financialMovements',
            $this->headerAuthentification,
        );
 
        $this->validatorResponse($response);
 
        return $response->toArray();
    }
 
    /**
     * check if no error api
     *
     * @param [type] $response
     * @throw  IbanFirstApiException
     * @return boolean true if succes
     */
    private function validatorResponse($response) : bool
    {
        if(!$response)
            throw new IbanFirstApiException('Problem for get wallets with oban first api', 400);
        return true;
    }
 
    private function headerAuthentification(string $username, string $password) : array
    {
        $nonce = '';
        $chars = "0123456789abcdef";
        for ($i = 0; $i < 32; $i++) {
            $nonce .= $chars[rand(0, 15)];
        }
        $nonce64 = base64_encode($nonce) ;
 
        // Getting the date at the right format (e.g. YYYY-MM-DDTHH:MM:SSZ)
        $date = gmdate('c');
        $date = substr($date,0,19)."Z" ;
 
        // Getting the password digest
        $digest = base64_encode(sha1($nonce.$date.$password, true));
 
        // Getting the X-WSSE header to put in your request
        $this->headerAuthentification['headers']['X-WSSE'] = sprintf('X-WSSE: UsernameToken Username="%s", PasswordDigest="%s", Nonce="%s", Created="%s"',$username, $digest, $nonce64, $date);
        return $this->headerAuthentification;
    }
}
Edit:
Problème d'espace dans le mot de passe et problème d'encodage de l'url c'est good pour moi.