Hello, i dont know what i am doing wrong but for some reasons i can’t access my api i keep getting
{error: not_authenticated, description: The user does not have an active session or is not authenticated}
my flutter code:
Future fetchParentDetails() async {
try {
var url = Uri.parse(
'https://mobile-api-teal.vercel.app/api/parent/get',
);
isLoading.value = true;
final token = box.read('token');
var response = await http.get(
url,
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer $token',
},
);
isLoading.value = false;
if (response.statusCode == 200) {
// handle successful response
print(json.decode(response.body));
} else {
// handle error response
print(json.decode(response.body));
}
} catch (e) {
isLoading.value = false;
rethrow;
}
}
Thanks