forked from eatvio/eatvio_app
added scopes for yandex id
This commit is contained in:
@@ -91,21 +91,6 @@ class SocialAuthFacade {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<String, dynamic>?> exchangeCodeForToken(String code, String clientId, String clientSecret) async {
|
|
||||||
final response = await http.post(
|
|
||||||
Uri.parse('https://oauth.yandex.ru/token'),
|
|
||||||
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
|
|
||||||
body: {'grant_type': 'authorization_code', 'code': code, 'client_id': clientId, 'client_secret': clientSecret},
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
|
||||||
return jsonDecode(response.body) as Map<String, dynamic>;
|
|
||||||
} else {
|
|
||||||
log('Error exchanging code: ${response.body}');
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Future<AuthResultEntity?> signInWithOkAndFetchProfile() async {
|
static Future<AuthResultEntity?> signInWithOkAndFetchProfile() async {
|
||||||
final context = AppRouter.navigatorKey.currentContext;
|
final context = AppRouter.navigatorKey.currentContext;
|
||||||
if (context == null) return null;
|
if (context == null) return null;
|
||||||
@@ -134,7 +119,8 @@ class SocialAuthFacade {
|
|||||||
'response_type': 'code',
|
'response_type': 'code',
|
||||||
'client_id': clientId,
|
'client_id': clientId,
|
||||||
'redirect_uri': redirectUri,
|
'redirect_uri': redirectUri,
|
||||||
'force_confirm': 'yes',
|
'scope': 'login:info login:email',
|
||||||
|
'force_confirm': 'true',
|
||||||
}).toString();
|
}).toString();
|
||||||
|
|
||||||
final redirectSchemePrefix = redirectUri;
|
final redirectSchemePrefix = redirectUri;
|
||||||
|
|||||||
Reference in New Issue
Block a user