Hi,
Did any one make a Password Based Authentication with flutter ?
with Token Based Authentication worked fine for me.
thanks for help.
1 Like
If you are ok with cookies, then just use the following API and store the returned cookies with Dio or similar.
var headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
};
var request = http.Request('GET', Uri.parse('https://example.com/api/method/login'));
request.body = '''{\n "usr": "demo@example.com",\n "pwd": "demo@example"\n}''';
request.headers.addAll(headers);
http.StreamedResponse response = await request.send();
if (response.statusCode == 200) {
print(await response.stream.bytesToString());
}
else {
print(response.reasonPhrase);
}
1 Like