API HTTP Agent

Database & APIs

Hello,

I'm passing for a problem, normally I need just headers and/or query parameters. However, now I need certificate as HTTP Agent, because it's a requirement for it to work.

Below is the code in Python to get Token:

#Desenvolvido pela Consultoria Técnica da Efí

import requests
import base64

credentials = {
  "client_id": "YOUR-CLIENT-ID",
  "client_secret": "YOUR-CLIENT-SECRET",
}

certificado = './certificado.pem'  # A variável certificado é o diretório em que seu certificado em formato .pem deve ser inserido

auth = base64.b64encode(
  (f"{credentials['client_id']}:{credentials['client_secret']}"
   ).encode()).decode()

url = "https://pix.api.efipay.com.br/oauth/token"  #Para ambiente de Desenvolvimento

payload="{\r\n    \"grant_type\": \"client_credentials\"\r\n}"
headers = {
  'Authorization': f"Basic {auth}",
  'Content-Type': 'application/json'
}

response = requests.request("POST",
                          url,
                          headers=headers,
                          data=payload,
                          cert=certificado)

print(response.text)

how can I get the token and do request? The token should be generate every time that I request.

What have you tried so far?

First, I tried create a custom action that do two things at the same time, but always return null.

Did you check FlutterFlow's Documentation for this topic?
Yes