Require Google server client ID for sign-in
This commit is contained in:
parent
ab6ce48a83
commit
7f365d6ce5
@ -9,6 +9,10 @@ const everyonePersonId = '_everyone';
|
|||||||
const defaultJarvisApiUrl = 'https://api-test.a-web.hu';
|
const defaultJarvisApiUrl = 'https://api-test.a-web.hu';
|
||||||
const legacyJarvisApiUrl = 'http://80.211.202.74';
|
const legacyJarvisApiUrl = 'http://80.211.202.74';
|
||||||
const appVersionLabel = 'v1.0.0+1';
|
const appVersionLabel = 'v1.0.0+1';
|
||||||
|
const googleCalendarServerClientId = String.fromEnvironment(
|
||||||
|
'GOOGLE_SERVER_CLIENT_ID',
|
||||||
|
defaultValue: '',
|
||||||
|
);
|
||||||
|
|
||||||
const avatarPresets = [
|
const avatarPresets = [
|
||||||
AvatarPreset('boy', 'Fi\u00fa', '\u{1f9d2}'),
|
AvatarPreset('boy', 'Fi\u00fa', '\u{1f9d2}'),
|
||||||
|
|||||||
@ -49,7 +49,7 @@ class _AccountsPageState extends State<AccountsPage> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await googleSignIn.initialize();
|
await _ensureGoogleInitialized();
|
||||||
initialized = true;
|
initialized = true;
|
||||||
final lightweight = googleSignIn.attemptLightweightAuthentication();
|
final lightweight = googleSignIn.attemptLightweightAuthentication();
|
||||||
final account = lightweight == null ? null : await lightweight;
|
final account = lightweight == null ? null : await lightweight;
|
||||||
@ -100,7 +100,7 @@ class _AccountsPageState extends State<AccountsPage> {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
await googleSignIn.initialize();
|
await _ensureGoogleInitialized();
|
||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
final account = await googleSignIn.authenticate(scopeHint: calendarScopes);
|
final account = await googleSignIn.authenticate(scopeHint: calendarScopes);
|
||||||
@ -115,6 +115,19 @@ class _AccountsPageState extends State<AccountsPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _ensureGoogleInitialized() async {
|
||||||
|
if (googleCalendarServerClientId.isEmpty) {
|
||||||
|
throw Exception(
|
||||||
|
'Hi\u00e1nyzik a Google server client ID. Add meg buildel\u00e9skor: '
|
||||||
|
'--dart-define=GOOGLE_SERVER_CLIENT_ID=<Web application OAuth client ID>',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
await googleSignIn.initialize(
|
||||||
|
serverClientId: googleCalendarServerClientId,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _loadGoogleCalendars({bool promptIfNecessary = true}) async {
|
Future<void> _loadGoogleCalendars({bool promptIfNecessary = true}) async {
|
||||||
setState(() {
|
setState(() {
|
||||||
loadingCalendars = true;
|
loadingCalendars = true;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user