Last updated:
0 purchases
oauth2 dio
oauth2_dio #
Implement #
1, OAuthInfoMixin #
Object hold info (token, refreshToken) is a mixin of OAuthInfoMixin
2, Create Oauth2Interceptor #
_oauth2manager = Oauth2Manager<SignInResponse>(
currentValue: token,
onSave: (value) {
//TODO Save token to SharePreference
});
_dio.interceptors.add(
Oauth2Interceptor(
dio: _dio,
oauth2Dio:
Dio(BaseOptions(baseUrl: 'http://abc.xyz/api/')),
pathRefreshToken: 'auth/refreshToken',
parserJson: (json) {
//TODO Parser json to object which a mixin of OAuthInfoMixin
},
tokenProvider: _oauth2manager,
),
);
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.