forked from eatvio/eatvio_app
feat(auth): Issue-691
This commit is contained in:
@@ -389,63 +389,46 @@ class _SocialButton extends StatelessWidget {
|
||||
}
|
||||
|
||||
void _onVkPressed(BuildContext context) async {
|
||||
print('[VK] VK button pressed');
|
||||
try {
|
||||
final accessToken = await SocialAuthFacade.signInWithVk(context: context);
|
||||
print('[VK] Got access token: ${accessToken != null ? 'success' : 'null'}');
|
||||
if (accessToken == null) {
|
||||
print('[VK] No access token received');
|
||||
return;
|
||||
}
|
||||
final isAuthenticated = await sl<AuthCubit>().getTokenBySocial(provider: 'vk', accessToken: accessToken);
|
||||
print('[VK] Authentication result: $isAuthenticated');
|
||||
if (isAuthenticated) {
|
||||
if (AppRouter.navigatorKey.currentContext != null) {
|
||||
// Reuse success flow
|
||||
// ignore: use_build_context_synchronously
|
||||
await _reconnectAfterAuth();
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
print('[VK] Error during VK auth: $e');
|
||||
}
|
||||
}
|
||||
|
||||
void _onOkPressed() async {
|
||||
print('[OK] OK button pressed');
|
||||
try {
|
||||
final accessToken = await SocialAuthFacade.signInWithOk();
|
||||
print('[OK] Got access token: ${accessToken != null ? 'success' : 'null'}');
|
||||
if (accessToken == null) {
|
||||
print('[OK] No access token received');
|
||||
return;
|
||||
}
|
||||
final isAuthenticated = await sl<AuthCubit>().getTokenBySocial(provider: 'ok', accessToken: accessToken);
|
||||
print('[OK] Authentication result: $isAuthenticated');
|
||||
if (isAuthenticated) {
|
||||
await _reconnectAfterAuth();
|
||||
}
|
||||
} catch (e) {
|
||||
print('[OK] Error during OK auth: $e');
|
||||
}
|
||||
}
|
||||
|
||||
void _onMailRuPressed() async {
|
||||
print('[MailRu] MailRu button pressed');
|
||||
try {
|
||||
final accessToken = await SocialAuthFacade.signInWithMailRu();
|
||||
print('[MailRu] Got access token: ${accessToken != null ? 'success' : 'null'}');
|
||||
if (accessToken == null) {
|
||||
print('[MailRu] No access token received');
|
||||
return;
|
||||
}
|
||||
final isAuthenticated = await sl<AuthCubit>().getTokenBySocial(provider: 'mailru', accessToken: accessToken);
|
||||
print('[MailRu] Authentication result: $isAuthenticated');
|
||||
if (isAuthenticated) {
|
||||
await _reconnectAfterAuth();
|
||||
}
|
||||
} catch (e) {
|
||||
print('[MailRu] Error during MailRu auth: $e');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user