diff --git a/.env.example b/.env.example index 074fb39..9f48c08 100644 --- a/.env.example +++ b/.env.example @@ -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. \ No newline at end of file diff --git a/app.js b/app.js index 43d1e29..8423fa1 100644 --- a/app.js +++ b/app.js @@ -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) => {