Skip to content

Commit

Permalink
fix: Sign Up with Facebook
Browse files Browse the repository at this point in the history
  • Loading branch information
jinx-vi-0 committed Mar 16, 2024
1 parent b595b87 commit 9bd7c3c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,39 @@ FACEBOOK_APP_SECRET=
PUBLIC_BASENAME=http://localhost:3000/
PORT=3000
MONGO_SERVER=mongodb://127.0.0.1:27017


## How to get your GOOGLE_ID and GOOGLE_SECRET

# Create a Google Cloud Platform (GCP) Project:
# - Go to the Google Cloud Console.
# - Create a new project by clicking on the project dropdown menu at the top of the page and selecting "New Project".
# - Follow the prompts to name your project and select your organization.
# - Enable the Google Sign-In API:

# In the Cloud Console, go to the "APIs & Services" > "Library".
# - Search for "Google Sign-In API" and select it.
# - Click on the "Enable" button to enable the API for your project.
# - Create OAuth 2.0 Credentials:

# In the Cloud Console, navigate to "APIs & Services" > "OAuth consent screen".
# - Choose either "External" or "Internal" based on your use case and fill in the required information.
# - After setting up the consent screen, go to "APIs & Services" > "Credentials".
# - Click on "Create Credentials" and select "OAuth client ID".
# - Choose "Web application" as the application type.
# - In the "Authorized redirect URIs" section, add the URL where users will be redirected after signing in with Google. Typically, this would be something like https://yourwebsite.com/auth/google/callback.
# - Click "Create" to generate your OAuth 2.0 credentials. This will provide you with your GOOGLE_ID (Client ID) and GOOGLE_SECRET (Client Secret).


# ## How to get your FACEBOOK_APP_ID and FACEBOOK_APP_SECRET

# Create a Facebook Developer Account:
# - Go to the Facebook Developer website (https://developers.facebook.com/) and sign in with your Facebook credentials.
# - Create a new app by clicking on the "My Apps" dropdown menu at the top right corner and selecting "Create App."
# - Follow the prompts to set up your new app. Choose a display name, category, and other relevant details.

# Configure Basic Settings:
# - Once your app is created, navigate to the app dashboard.
# - Under the "Settings" tab, go to the "Basic" section.
# - Add your website domain under "App Domains" and save the changes.
# - Note down your App ID and App Secret.
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ passport.use(
{
clientID: process.env.FACEBOOK_APP_ID,
clientSecret: process.env.FACEBOOK_APP_SECRET,
callbackURL: `${process.env.PUBLIC_BASENAME}auth/google/secrets`,
callbackURL: `${process.env.PUBLIC_BASENAME}auth/facebook/secrets`,
},
function (accessToken, refreshToken, profile, cb) {
User.findOne({ facebookId: profile.id }, (err, existingUser) => {
Expand Down

0 comments on commit 9bd7c3c

Please sign in to comment.