Issue
I have flutter app where user input data and that data is stored on mysql. Everything works perfect on my PHP, HTML on web. But in flutter I can't get session of user.
Future getData() async {
var url = 'https://azer.maverus.ba/api/read.php';
var response = await http.get(Uri.parse(url));
return json.decode(response.body);
} I have that script and it read only data that I type inside flutter. And can't read data from database from curent user.
Solution
You have to add header to pass Authorization key to the API check the code below
Future getData() async {
var url = 'https://azer.maverus.ba/api/read.php';
var response = await http.get(Uri.parse(url),headers: <String, String>{
"Authorization" : "YOUR KEY HERE"
});
return json.decode(response.body);
}
Answered By - Diwyansh
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.