Hi FF community, I would like to share this with you in case some one need it. Long story short: Some of the services out there provide a REST API for their services that we can use in our apps that we build in FlutterFlow …. And among them services that requires a Signature to be added to the api request as a parameter to authenticate the request . And you need to create this signature manually. My case: I’m using a Media cloud service (uploading images and videos to a cloud connected to my app…etc) and it’s requires a signed requests which means I have to create signature manually then hash the result with SHA1 or SHA256 and add it to the request (Post, Get, Delete…etc) with other parameters. My use case: I want to send a Post request to delete (destroy) an uploaded image, and the syntax URL for that request as follows https://api.cloudinary.com/v1_1/demo/image/destroy And the required parameters [A7C28776-4723-4DBF-B67D-03CE43BEFBCF.jpeg]1- Generating a signature According to the docs [214A92D3-BE4C-4F53-A3C9-0BB53F8265C6.jpeg] So I’ve created this custom action code to generate a signature and hash the outcome with SHA1
import 'package:crypto/crypto.dart';
import 'dart:convert'; // for the utf8.encode method
Future cloudinarySignature(
int timestamp,
String publicID,
) async {
// Add your function code here!
String apiSecret = "****************************";
var bytes = utf8.encode("public_id=$publicID×tamp=$timestamp$apiSecret"); // data being hashed
var signature = sha1.convert(bytes);
return "$signature";
}
[D1056F1C-E9A4-42FB-AD41-6633E70C2AAE.jpeg] with 2 arguments (timestamp, publicID “Of the image that I want to delete") and added 2 dependencies (crypto, convert) 2- Actions (Delete button) first the generate signature action [2457F222-FD7B-4838-B79C-F25F280F8960.jpeg] then the API call action adding to it the result of the previous action (signature) with other parameters [A630B8BD-8A8C-483E-A2A1-C49793750EE5.jpeg] THE END 😉👍🏻