Yes. Check what API official web app is using and do the same thing.
Thank you, I've found this:
response = await fetch('/api/password/reset', {
method: 'POST',
body: new URLSearchParams(`email=${encodeURIComponent(email)}`),
You can also just look at network requests using your browser network tool, which is much easier than searching the code.
Can somebody help me with this code in dart/flutter for password reset?
static Future<http.Response> passwordReset(String email) async {
headers['content-type'] = "application/json; charset=utf-8";
headers['Accept'] = "application/json";
String request = json.encode("email=" + Uri.encodeQueryComponent(email));
final response = await http.post(
Uri.parse("https://mytraccarserver.com/api/password/reset"),
body: request,
headers: headers
);
return response;
}
Now the response is "Unsupported Media Type"
Content type is obviously wrong. Have you checked what official web app sends as I recommended? Please provide it here.
Ok solved, thank you.
The correct lines are:
headers['content-type'] = "application/x-www-form-urlencoded; charset=UTF-8";
String request = "email=" + Uri.encodeQueryComponent(email);
Hi,
is there any option to send a pasword reset email from API or by http parameters POST or GET?
Thank you!