From 8d30f3a9439685667e5703c14791615446df3e4c Mon Sep 17 00:00:00 2001 From: Hans Kokx Date: Fri, 20 Sep 2024 15:46:47 +0200 Subject: [PATCH] Updated example in README Signed-off-by: Hans Kokx --- README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 77f574a..05a70e8 100644 --- a/README.md +++ b/README.md @@ -240,6 +240,8 @@ The Arcane Framework provides a useful interface for performing common authentic To get started, create an authentication interface provider and register it in the Arcane authentication module: ```dart +typedef LoginInput = ({String email, String password}); + // Create an authentication interface class AuthProviderInterface implements ArcaneAuthInterface { AuthProviderInterface._internal(); @@ -287,14 +289,19 @@ class AuthProviderInterface implements ArcaneAuthInterface { } @override - Future> loginWithEmailAndPassword({ - required String email, - required String password, + Future> login({ + LoginInput? input, + Future Function()? onLoggedIn, }) async { final bool alreadyLoggedIn = await isSignedIn; if (alreadyLoggedIn) return Result.ok(null); + final credentials = input as ({String email, String password}); + + final String email = credentials.email; + final String password = credentials.password; + try { final SignInResult result = await _session.signIn( username: email,