I need to implement a REST API in FireMonkey to get some information, but I’m not sure how I can do it.
The REST API uses OAuth2, I have access to two codes: Consumer Key and Consumer Secret. After this, I need to get a temporary Bearer token.
To request the temporary token, it is necessary to perform an HTTP POST request to the Token endpoint https://apigateway.serpro.gov.br/token, informing the access credentials (consumerKey: consumerSecret) in the HTTP
Authorization Header, in base64 format, as shown below.
[POST] grant_type = client_credentials
[HEAD] Authorization: Basic Base64 (Consumer key: ConsumerSecret)
How can I get the access token with Delphi?