Skip to content

Commit 0277752

Browse files
Set eid on onesignal on user login
1 parent 2e747f8 commit 0277752

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/screens/auth/login_screen.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,15 @@ class _LoginFormState extends State<LoginForm> {
4848
try {
4949
final email = _emailController.text;
5050
final password = _passwordController.text;
51-
await Supabase.instance.client.auth.signInWithPassword(
51+
final authResponse =
52+
await Supabase.instance.client.auth.signInWithPassword(
5253
email: email,
5354
password: password,
5455
);
56+
final id = authResponse.user?.id;
57+
if (id != null) {
58+
OneSignal.shared.setExternalUserId(id);
59+
}
5560
} catch (e) {
5661
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
5762
content: Text(e.toString() ?? "Login failed"),

0 commit comments

Comments
 (0)