Reputation: 31
Here is my code:
var url = 'http://myURL';
String tokens = "good token working on postman";
var response = await http.get(url, headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer $tokens',
});
print('Token : ${tokens}');
print(response.body);
The problem is that the token and the api url is working well on PostMan but it looks like flutter doesn't send the token. It returns me a web page content.
Upvotes: 3
Views: 4642
Reputation: 21
var response = await http
.get(Uri.parse('http://192.168.1.32:8000/api/users'), headers: {
'Authorization': 'Bearer ' + sharedPreferences.getString("access_token"),
});
Upvotes: 1