Some checks are pending
Backend CI / test (push) Waiting to run
Backend CI / build (push) Blocked by required conditions
Mobile App CI / test (push) Waiting to run
Mobile App CI / build-android (push) Blocked by required conditions
Mobile App CI / build-ios (push) Blocked by required conditions
Web App CI / test (push) Waiting to run
Web App CI / build (push) Blocked by required conditions
Deploy Mnemo Cards / Deploy Backend (push) Waiting to run
Deploy Mnemo Cards / Deploy Web App (push) Blocked by required conditions
Deploy Mnemo Cards / Final Verification (push) Blocked by required conditions
Deploy Telegram Bot / Deploy Telegram Bot (push) Waiting to run
23 lines
654 B
Dart
23 lines
654 B
Dart
import 'package:dio/dio.dart' as dio;
|
|
import 'package:injectable/injectable.dart';
|
|
|
|
@lazySingleton
|
|
class GoogleApi {
|
|
const GoogleApi();
|
|
|
|
Future<String?> getGoogleUserId(String googleIdToken) async {
|
|
final v = dio.Dio();
|
|
final response = await v.get(
|
|
'https://www.googleapis.com/oauth2/v1/tokeninfo?id_token=' +
|
|
googleIdToken,
|
|
);
|
|
print(response.data); //contains the token info
|
|
final userId = response.data['user_id'].toString();
|
|
final expiresInSeconds = response.data['expires_in'];
|
|
// final email = response.data['email'];
|
|
if (expiresInSeconds > 0) {
|
|
return userId;
|
|
}
|
|
return null;
|
|
}
|
|
}
|