From 16c8c06fe4c37b8055a7a66915c8f96eddf9bf8b Mon Sep 17 00:00:00 2001 From: Mark Burggraf Date: Mon, 7 Jun 2021 20:11:30 -0700 Subject: [PATCH 1/2] client code added for FB login --- web/docs/guides2/auth-facebook.mdx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/web/docs/guides2/auth-facebook.mdx b/web/docs/guides2/auth-facebook.mdx index cde82ffe4a9..2ae6abd9d16 100644 --- a/web/docs/guides2/auth-facebook.mdx +++ b/web/docs/guides2/auth-facebook.mdx @@ -69,6 +69,7 @@ From the "Add Products to your App" screen: - Click "Settings / Basic" in the left sidebar - Copy your App ID from the top of the "Basic Settings" page - Under "App Secret" click "Show" then copy your secret +- Make sure all required fields are completed on this screen. ### Enter your Facebook App ID and Secret into your Supabase Project @@ -80,7 +81,15 @@ From the "Add Products to your App" screen: - Enter your "Facebook client ID" and "Facebook secret" saved in the previous step - Click "Save" -### TODO - JavaScript Client API +### Add login code to your client app + +The JavaScript client code is documented here: [Supabase OAauth Client Code](https://supabase.io/docs/reference/javascript/auth-signin#sign-in-using-third-party-providers) + +```js +const { user, session, error } = await supabase.auth.signIn({ + provider: 'facebook' +}) +``` ## Resources From fc1e9f6eb89953fc02f2864ec72501f128340d39 Mon Sep 17 00:00:00 2001 From: Mark Burggraf Date: Mon, 7 Jun 2021 20:17:54 -0700 Subject: [PATCH 2/2] client code added for FB login --- web/docs/guides2/auth-facebook.mdx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/web/docs/guides2/auth-facebook.mdx b/web/docs/guides2/auth-facebook.mdx index 2ae6abd9d16..ee8327c5e84 100644 --- a/web/docs/guides2/auth-facebook.mdx +++ b/web/docs/guides2/auth-facebook.mdx @@ -91,6 +91,23 @@ const { user, session, error } = await supabase.auth.signIn({ }) ``` +Just put this code in a function and create a button or a link or any other UI element to call the function. + +```js +function signInWithFacebook() { + const { user, session, error } = await supabase.auth.signIn({ + provider: 'facebook' + }); +} +``` + +To log out: + +```js +function signout() { + const { error } = await supabase.auth.signOut(); +} +``` ## Resources