Currently, we need to pass Dio for making HTTP call to fetch CourierConnectOptions. For clients that don't need to fetch the auth from network, they have to create an endpoint and return the response.
This MR solves the problem by creating AuthProvider interface with one method to fetchConnectOptions that returns a Future so it will work for async dio http call as well as just returning the value by creating an immediate future value.
I have provided a concrete implementations for the interface:
DioAuthProvider -> Use dio to make async http call given an URL to fetch CourierConnectOptions AuthResponse
I also included example LocalAuthProvider in sample demo app for retrieving connect options locally without making http api call.
Currently, we need to pass
Dio
for making HTTP call to fetchCourierConnectOptions
. For clients that don't need to fetch the auth from network, they have to create an endpoint and return the response.This MR solves the problem by creating
AuthProvider
interface with one method to fetchConnectOptions that returns aFuture
so it will work for async dio http call as well as just returning the value by creating an immediate future value.I have provided a concrete implementations for the interface:
DioAuthProvider
-> Use dio to make async http call given an URL to fetch CourierConnectOptions AuthResponseI also included example
LocalAuthProvider
in sample demo app for retrieving connect options locally without making http api call.