I am using the following article as a guide:
Control of access in apps using basic connection | Make Apps
I have implemented a validation API infrastructure in AWS, I can validate a token/email pair and it returns a verified message and expiration date as a response.
The code for the connection:
{
// Step 2: OAuth2 token request
“token”: {
// The condition ensures that the token directive is not only executed when
// connection is being created, but also when the connection is going to
// expire in 1 minute.
// The call in the token directive is executed when a module with expired
// connection is triggered.
“condition”: “{{if(data.expires, data.expires < addMinutes(now, 1), true)}}”,
//“condition”: true,
// URL to the webhook in the scenario handling access control backend.
// Passing the user’s token to the webhook.
“url”: “https://aws-api-details/validate”,
“method”: “POST”,
“headers”: {
“Content-Type”: “application/json”
},
“body”: {
“email”: “{{parameters.email}}”,
“token”: “{{parameters.token}}”
},
“response”: {
“error”: {
// Mapping the error message from the webhook’s response.
“message”: “[{{statusCode}}]: {{body.error}}”
},
“data”: {
// Mapping the date-time of expiration from the webhook’s response.
“expires”: “{{body.expires}}”
}
},
“log”: {
“sanitize”: [
“request.headers.authorization”
]
}
},
// Request to get authorized user information
“info”: {
// Verify Groq API validity
“url”: “https://api.groq.com/openai/v1/chat/completions”,
“method”: “POST”,
“headers”: {
“Authorization”: “Bearer {{parameters.apiKey}}”,
“Content-Type”: “application/json”
},
“body”: {
“messages”: [ { “role”: “user”, “content”: “can you hear me?” } ],
“model”: “mixtral-8x7b-32768”
},
“log”: {
“sanitize”: [
“request.headers.authorization”
]
}
}
}
Parameters Code:
[
{
“name”: “apiKey”,
“type”: “password”,
“label”: “API Key”,
“help”: “Enter the API key provided by Company”,
“required”: true
},
{
“name”: “email”,
“type”: “email”,
“label”: “Registered email address.”,
“help”: “Enter the email that was registered with developer.”,
“required”: true
},
{
“name”: “token”,
“type”: “text”,
“label”: “Access Token”,
“help”: “Enter the app access token provided when you registered.”,
“required”: true
}
]
When I create a new connection with intentionally wrong email or access token it launches a blank pop-up then closes and get a small error block in make but it creates the connection anyway and it works as normal. It only fails if the API key is incorrect. Does anyone see any problems with the code as to why 1) it shows that blank pop-up 2) why it doesn’t fail when it should 3) any foreeable problems with it not renewing when the expiration date comes around?
I appreciate any help anyone can provide