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

Comunidade

Ask a Question
Back to All

Duvidas, tenho um app cad. no sandbox: id da app: 67755519-95a4-4a69-b2f3-cc9d79e09ae6

Minha App vai rodar localmente em ambiente seguro:

Consegui recuperar o token na url: https://id.sandbox.btgpactual.com/oauth2/token passando o cliendid e cliente_secret

{
    "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6ImF0K2p3dCIsImtpZCI6Im05TDBhUGZkdGdkVUNCMHkyaTJKTi1vWWNFVGFJNG1ROTNqMER3Wi1LOFEifQ.eyJzdWIiOm51bGwsImdyYW50X3R5cGUiOiJjbGllbnRfY3JlZGVudGlhbHMiLCJzY29wZSI6ImVtcHJlc2FzLmJ0Z3BhY3R1YWwuY29tL2FjY291bnRzIiwiaXNzIjoiaHR0cHM6Ly9pZC5zYW5kYm94LmJ0Z3BhY3R1YWwuY29tIiwiZXhwIjoxNjc4MzAwMzgxLCJpYXQiOjE2NzgyMTM5ODEsImNsaWVudF9pZCI6IjY3NzU1NTE5LTk1YTQtNGE2OS1iMmYzLWNjOWQ3OWUwOWFlNiIsImp0aSI6InFlbURUWHRzaFhLVENZOXVMY1BGZlBCUHNUNHlOVmZ1cXF3OGpQWEFMclEifQ.CQCshN210pwVx-ZPaf34-ny4zo32hdJT3w-NY-3Db8mWBE1vNSb3uwX101EBHziKE4R4hYIj_5dQOIjtMhnqR8HUw5xj0KYc8d1btiQy1da0Bp8ulTtCkPEwi7PD475Vpt9EeKg6tkMb2d_9TE6y08LBTRkn-vtaSGIxe6PnVLfA9r4d3FEcNq6nAd9TKOKE_d-v4T3F5yoFrADYoGzVmBvw-Yh25FvYnyhcLkhLLPa1Zcqtxls6C-79vKvR9ToKXurII8J79_4vy3CH-xe9djo_evXv0fXHhe0EEuSjsS8Eb2guVo-Jgwql2hoErcCrPudD2_bAMOn06dtbnMAGGQ",
    "scope": "empresas.btgpactual.com/accounts",
    "token_type": "Bearer",
    "expires_in": 86400
}

Tentei executar o codigo abaixo copiado de " https://developers.empresas.btgpactual.com/reference/post_companies-companyid-pix-cash-in-locations"

curl --request POST \
     --url https://api.sandbox.empresas.btgpactual.com/v1/companies/30306294000145/pix-cash-in/locations \
     --header 'accept: application/json' \
     --header 'authorization: Bearer
eyJhbGciOiJSUzI1NiIsInR5cCI6ImF0K2p3dCIsImtpZCI6Im05TDBhUGZkdGdkVUNCMHkyaTJKTi1vWWNFVGFJNG1ROTNqMER3Wi1LOFEifQ.eyJzdWIiOm51bGwsImdyYW50X3R5cGUiOiJjbGllbnRfY3JlZGVudGlhbHMiLCJzY29wZSI6ImVtcHJlc2FzLmJ0Z3BhY3R1YWwuY29tL2FjY291bnRzIiwiaXNzIjoiaHR0cHM6Ly9pZC5zYW5kYm94LmJ0Z3BhY3R1YWwuY29tIiwiZXhwIjoxNjc4MzAwMzgxLCJpYXQiOjE2NzgyMTM5ODEsImNsaWVudF9pZCI6IjY3NzU1NTE5LTk1YTQtNGE2OS1iMmYzLWNjOWQ3OWUwOWFlNiIsImp0aSI6InFlbURUWHRzaFhLVENZOXVMY1BGZlBCUHNUNHlOVmZ1cXF3OGpQWEFMclEifQ.CQCshN210pwVx-ZPaf34-ny4zo32hdJT3w-NY-3Db8mWBE1vNSb3uwX101EBHziKE4R4hYIj_5dQOIjtMhnqR8HUw5xj0KYc8d1btiQy1da0Bp8ulTtCkPEwi7PD475Vpt9EeKg6tkMb2d_9TE6y08LBTRkn-vtaSGIxe6PnVLfA9r4d3FEcNq6nAd9TKOKE_d-v4T3F5yoFrADYoGzVmBvw-Yh25FvYnyhcLkhLLPa1Zcqtxls6C-79vKvR9ToKXurII8J79_4vy3CH-xe9djo_evXv0fXHhe0EEuSjsS8Eb2guVo-Jgwql2hoErcCrPudD2_bAMOn06dtbnMAGGQ' \
     --header 'content-type: application/json' \
     --data '
{
     "type": "cob",
     "description": "descrição de exemplo"
}'

Retornou a msg e no ambiente do api reference a mesma mensagem, o que está errado ? obs. com o cnpj da empresa inicial 09.296 ..... acontece a mesma coisa

{"fault":{"faultstring":"Invalid token: policy(VerifyJWT)","detail":{"errorcode":"steps.jwt.InvalidToken"}}}%

Tentei executar a chamada somente para teste o mesmo problema

curl --request GET \
     --url https://api.sandbox.empresas.btgpactual.com/v1/accounts \
     --header 'accept: application/json' \
     --header 'authorization: Bearer
eyJhbGciOiJSUzI1NiIsInR5cCI6ImF0K2p3dCIsImtpZCI6Im05TDBhUGZkdGdkVUNCMHkyaTJKTi1vWWNFVGFJNG1ROTNqMER3Wi1LOFEifQ.eyJzdWIiOm51bGwsImdyYW50X3R5cGUiOiJjbGllbnRfY3JlZGVudGlhbHMiLCJzY29wZSI6ImVtcHJlc2FzLmJ0Z3BhY3R1YWwuY29tL2FjY291bnRzIiwiaXNzIjoiaHR0cHM6Ly9pZC5zYW5kYm94LmJ0Z3BhY3R1YWwuY29tIiwiZXhwIjoxNjc4MzAwMzgxLCJpYXQiOjE2NzgyMTM5ODEsImNsaWVudF9pZCI6IjY3NzU1NTE5LTk1YTQtNGE2OS1iMmYzLWNjOWQ3OWUwOWFlNiIsImp0aSI6InFlbURUWHRzaFhLVENZOXVMY1BGZlBCUHNUNHlOVmZ1cXF3OGpQWEFMclEifQ.CQCshN210pwVx-ZPaf34-ny4zo32hdJT3w-NY-3Db8mWBE1vNSb3uwX101EBHziKE4R4hYIj_5dQOIjtMhnqR8HUw5xj0KYc8d1btiQy1da0Bp8ulTtCkPEwi7PD475Vpt9EeKg6tkMb2d_9TE6y08LBTRkn-vtaSGIxe6PnVLfA9r4d3FEcNq6nAd9TKOKE_d-v4T3F5yoFrADYoGzVmBvw-Yh25FvYnyhcLkhLLPa1Zcqtxls6C-79vKvR9ToKXurII8J79_4vy3CH-xe9djo_evXv0fXHhe0EEuSjsS8Eb2guVo-Jgwql2hoErcCrPudD2_bAMOn06dtbnMAGGQ'
{"fault":{"faultstring":"Failed to Resolve Variable : policy(VerifyJWT) variable(null)","detail":{"errorcode":"steps.jwt.FailedToResolveVariable"}}}%