Skip to main content

Setup Environment Variables

MAPS_API_KEY

  • Enable the Google Maps APIs:
    • In the Cloud Console, navigate to “API & Services > Dashboard”.
    • Click “ENABLE APIS AND SERVICES”.
    • Search for “Maps” and enable APIs you need, like "Geocoding API".
  • Get the API Key:
    • In the Cloud Console, go to “Google Maps Platform”.
    • Click on “Keys & credentials”.
    • Your Maps API key will appear there.
  • Replace MAPS_API_KEY with your key.

Google Login

  • Enable Google+ API:
    • Navigate to the "APIs & Services" dashboard.
    • Click on “ENABLE APIS AND SERVICES”.
    • Search for and enable the "Google+ API".
  • Create Credentials:
    • Go to the “Credentials” page within your project.
    • Click on “Create credentials”.
    • Select “OAuth client ID”.
  • Configure OAuth Consent Screen:
    • You may be prompted to configure the OAuth consent screen first.
    • Fill in the required fields like application name, support email, and authorized domains.
    • Save and continue.
  • Set Application Type:
    • Select the application type for your project = Web application.
    • Add authorized JavaScript origins and redirect URIs. Screenshot 2024-03-28 at 05.20.14.png
  • Get Your Client ID and Secret:
    • Once the OAuth client is created, you will see your Client ID and Client Secret.
    • Copy these credentials; they will be used in your Passport strategy configuration.

Set envs

IP API Key

Needed for IP geolocation

Twilio

For phone verification

  • TWILIO_ACCOUNT_SID
  • TWILIO_AUTH_TOKEN
  • TWILIO_VERIFY_SERVICE

Twilio Setup

  • Sign Up for Twilio: Go to the Twilio website and create an account.
  • Verify Email and Phone: Complete the verification of your email and phone number in the Twilio console.
  • Upgrade Account (if needed): Add billing information to upgrade from the trial.
  • Get Twilio Credentials: In the Twilio Console, find your TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN.
  • Request WhatsApp API Access: Go to "Programmable SMS" > "WhatsApp" in the Twilio Console and request access.
  • Create Messaging Service: Once approved, create a new Messaging Service for WhatsApp.
  • Create Verify Service: In the “Verify” section, create a new service. Note the TWILIO_VERIFY_SERVICE SID provided.

Firebase Service Account & IAP Setup

Needed for FCM & Google Play IAP

  • Create a Firebase account at https://console.firebase.google.com.
  • Go to your Firebase Console, select your project, and navigate to Project Settings.
  • Under the “Service accounts” tab, click “Generate new private key.” This will download a JSON file containing your service account credentials. Keep this file secure.
  • Create a .dev folder in the root project (make sure this folder is added in .gitignore).
  • Inside .dev, copy your service account file as this filename firebase-service-account.json.
  • Log in to the Google Cloud Console with the same email of the Firebase account.
  • Select Project: From the top-right dropdown menu, select the Google Cloud project (the same as Firebase).
  • IAM & Admin: In the left sidebar, navigate to IAM & Admin > IAM. Screenshot 2024-03-28 at 05.20.45.png
  • Click on edit principal. Screenshot 2024-03-28 at 05.20.53.png
  • Give it these permissions: Editor, Pub/Sub Admin, Android Management User.

Enable Google Play Android Developer API

  • In Google Cloud Console, search for “Google Play Android Developer API”.
  • Enable the API.
  • In GCP console, IAM & Admin > IAM.
  • Copy the principal’s email: e.g., “[email protected]
  • Go to https://play.google.com/console/
  • Navigate to Users and Permissions.
  • Click on Invite User.
  • Paste the principal’s email.
  • Add an app to grant permissions -> select your app -> Give admin access. Screenshot 2024-03-28 at 05.21.03.png
  • Save; Wait for at least 24 hours for changes to take effect.

Facebook App Credentials

  • Create a Facebook Developer Account:

    • Go to the Facebook Developers website.
    • Log in with your Facebook account.
    • If you don't have a developer account, you'll be prompted to create one.
  • Create a New App:

    • Navigate to 'My Apps'.
    • Click on 'Create App'.
    • Choose 'Consumer' for the type of app.
    • Fill in the details (App Name, Contact Email, etc.) and click ‘Create App ID’.
  • Configure Facebook Login:

    • Inside your App Dashboard, select 'Facebook Login'.
  • Get FACEBOOK_APP_ID and FACEBOOK_APP_SECRET:

    • These can be found in the 'Settings' > 'Basic' section of your app dashboard.
  • Set Up FACEBOOK_CALLBACK_URI:

    • This is the URL where Facebook will redirect users after authentication.
    • Example: https://YOUR_API_URL/v1/auth/facebook/callback
    • Set this up in 'Facebook Login' settings.
    • Make sure this URL is in 'Valid OAuth Redirect URIs' under 'Facebook Login' > 'Settings'.
  • Set Up FACEBOOK_SUCCESS_REDIRECT_URI

    • FACEBOOK_SUCCESS_REDIRECT_URI: After login success, it will redirect to this URL, and it will have “access_token” as a query param.

IOS APNs Auth Key

for notifications in IOS

  • Head to your Apple developer account.
  • Go to the keys section and click on the plus button. Screenshot 2024-03-28 at 05.21.35.png
  • Select the Apple push notification service. Screenshot 2024-03-28 at 05.22.04.png
  • Download the .p8 file and secure it somewhere.
  • Go to Firebase -> select your project -> settings -> cloud messaging -> under your iOS app -> APNs Authentication Key -> upload the .p8 file.

IOS IAP Subscriptions Private Key