From dd9c0f0c7cfba9b4a634a8669d17fe801639a761 Mon Sep 17 00:00:00 2001 From: Asutosh Ranjan Date: Wed, 12 Jul 2023 22:24:48 +0530 Subject: [PATCH 1/3] refreshing OAuth2 session dart code fix --- app/views/docs/oauth-providers/github.md | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/app/views/docs/oauth-providers/github.md b/app/views/docs/oauth-providers/github.md index cd4764173..b73b32202 100644 --- a/app/views/docs/oauth-providers/github.md +++ b/app/views/docs/oauth-providers/github.md @@ -280,17 +280,15 @@ void main() async { client .setEndpoint('https://cloud.appwrite.io/v1') // YOUR API Endpoint - .setProject('[PROJECT_ID]') // YOUR PROJECT ID - ; + .setProject('[PROJECT_ID]'); // YOUR PROJECT ID - // OAuth Login, for simplest implementation you can leave both success and - // failure link empty so that Appwrite handles everything. - final future = account.updateSession('current'); - future.then(function (response) { - console.log(response); // Success - }, function (error) { - console.log(error); // Failure - }); + + try { + final future = await account.updateSession(sessionId: 'current'); + print(future.toMap()); // Success + } on AppwriteException catch(e){ + print(e.message); // Failure + } } ``` From 8f28820b68c47a6faea6ca3c1e21f15609d9b8a1 Mon Sep 17 00:00:00 2001 From: Asutosh Ranjan Date: Thu, 13 Jul 2023 23:39:36 +0530 Subject: [PATCH 2/3] added comments back --- app/views/docs/oauth-providers/github.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/docs/oauth-providers/github.md b/app/views/docs/oauth-providers/github.md index b73b32202..6d908e4d6 100644 --- a/app/views/docs/oauth-providers/github.md +++ b/app/views/docs/oauth-providers/github.md @@ -282,7 +282,8 @@ void main() async { .setEndpoint('https://cloud.appwrite.io/v1') // YOUR API Endpoint .setProject('[PROJECT_ID]'); // YOUR PROJECT ID - + // Simplest implementation of updating auth session + // prints Session Object value on success and error message on failure try { final future = await account.updateSession(sessionId: 'current'); print(future.toMap()); // Success From 8e43d65dc4cdf426f41e9e4d93f6b18cb804d3c5 Mon Sep 17 00:00:00 2001 From: Asutosh Ranjan Date: Thu, 13 Jul 2023 23:49:56 +0530 Subject: [PATCH 3/3] type error --- app/views/docs/oauth-providers/github.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/oauth-providers/github.md b/app/views/docs/oauth-providers/github.md index 6d908e4d6..5993f7c36 100644 --- a/app/views/docs/oauth-providers/github.md +++ b/app/views/docs/oauth-providers/github.md @@ -282,7 +282,7 @@ void main() async { .setEndpoint('https://cloud.appwrite.io/v1') // YOUR API Endpoint .setProject('[PROJECT_ID]'); // YOUR PROJECT ID - // Simplest implementation of updating auth session + // Simplest implementation of updating an OAuth2 session // prints Session Object value on success and error message on failure try { final future = await account.updateSession(sessionId: 'current');