I have a Basic Auth token. In postman its working as expected but when i try same thing with same header its not working on flutter dio. Why its not working ? How can i fix it ?
In Postman :
But when i try same thing in flutter with dio like :
final Dio _basicAuthDio = Dio();
String cred = "username:password";
String credEnc = utf8.fuse(base64).encode(cred);
_basicAuthDio.options = BaseOptions(
baseUrl: "${ApiConstants.baseUrl}v2",
headers: {HttpHeaders.contentTypeHeader: "application/json", "Authorization": "Basic $credEnc"},
);
Its always giving me 404 error. Even data is same,endpoint is same, header is same. Why its happening ? How can i solve it ?
>Solution :
Make sure you didn’t forgot api/v2/… part. Is the same url showing up in request object details?


