Burin-Zhargal's picture
download
raw
1.02 kB
// In auth_util.dart
import 'package:appwrite/appwrite.dart';
import 'package:appwrite/enums.dart';
import 'package:advideos/utils/error.dart';
class AuthClass {
final Client client = Client();
late Account account;
AuthClass() {
client
.setEndpoint('https://nyc.cloud.appwrite.io/v1') // Your Appwrite endpoint
.setProject('685a7d03001331bd52a2'); // Your Appwrite project ID
account = Account(client);
}
Future<void> googleSignIn(context) async {
try {
await account.createOAuth2Session(provider: OAuthProvider.google);
await Future.delayed(const Duration(microseconds: 400));
// On return, you should check session or token and redirect
} on Exception {
showErrorDialog("Failed login or register", context);
}
}
Future<String?> getToken() async {
try {
final session = await account.getSession(sessionId: 'current');
return session.userId;
} on Exception {
return null;
}
}
}

Xet Storage Details

Size:
1.02 kB
·
Xet hash:
5e1bfc21b3b23c612eeb47033f7655027293bf25c84098ee683dd131e98f07a1

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.