These docs are for v1.2. Click to read the latest docs for v1.4.

Comunidade

Ask a Question
Back to All

Estou com problema de fazer Authorization Code com PKCE

Estou tentando autenticar, mas esta com erro:

$codeVerifier = base64_encode(random_bytes(32));

        // Gerar o code_challenge (usando o método S256)
        $codeChallenge = rtrim(strtr(base64_encode(hash('sha256', $codeVerifier, true)), '+/', '-_'), '=');
        $clientId = config('services.btg.client_id');
        $redirectUri = route('btg.callback');
        $scope = 'apps email openid profile webhooks';
        $authUrl = "https://id.btgpactual.com/oauth2/authorize?" . http_build_query([
            'client_id' => $clientId,
            'response_type' => 'code',
            'redirect_uri' => $redirectUri,
            'scope' => $scope,
            'code_challenge' => $codeChallenge,
            'code_challenge_method' => 'S256',
        ]);

        return redirect($authUrl);

{
"brn": "brn:btg🆔apps:errors:app-not-found",
"correlationId": "30a21434-1417-4423-bd7c-28c884df0660",
"name": "AppNotFoundError"
}