Hi Everyone,
I am new to flutterflow and I was wondering what is the best way to integrate an API which takes it's parameters encoded as a JWT, some return values are encoded to a JWT as well.
So for example, the Login API call would be as follows...
/user_session/create.json is the path
jwt is the parameter...
The JWT is generated from the json '{"username": "test", "password": "test"}' with a key which is stored in the app.
The response is a JWT which is decoded from the same key, which then decodes to something like '{"status": 200, "results": [{"user_token": "sfdsdfd"}]}'
We would store the user_token and then use that within any other authenticated api calls going forward.
So would the most efficient way be to create a custom action for each API call and just code each api call with the parameter conversion? Using this approach could I still bind the results from the custom action to UI widgets?
Or is there a way to put a custom actions/functions (to encode the parameter values received from the UI to a JWT) that get run before and after (when the results are jwt encoded) a FlutterFlow API call?
Any insights would be very much appreciated
Regards
Mark
Update:
I have discovered the Interceptors but I can't figure out how to change the body or params of the API request.
Is there any documentation with the object model or a way to look the /backend/api_requests/api_interceptor.dart code? I am trying to see what options I have available to me