Gravity
  • Welcome to Gravity
  • Getting Started
  • Stack
  • Updates
  • Rules For AI
  • Troubleshooting
  • Gravity Server
    • Introduction
    • Installation
      • Install Node.js
      • Database Setup
      • Stripe Setup
      • Mailgun Setup
      • Install Gravity
    • Application Structure
    • REST API
      • API Scopes
      • Webhooks
    • Authentication
      • Email Verification
      • Social Sign On
      • Two-Factor Authentication
    • Authorization
      • Feature Access and Plan Restrictions
      • Permissions (Roles)
    • Config
    • Environment Variables
    • Database Queries
    • Handling Errors
    • Logging
    • Localization
    • Push Notifications
    • Email Notifications
    • User Feedback
    • User Onboarding
    • File Uploads
    • Billing
      • Seat Billing
      • Usage Billing
    • Free Accounts
    • CLI Toolbelt
    • Testing
    • AI Tools
    • Background Jobs
    • Deployment
  • Gravity Web
    • Introduction
    • Tailwind & SCSS
    • Routing
    • Events
    • Authentication
    • Localization
    • Hooks
      • useAPI
      • usePlans
      • usePermissions
    • Components
      • Alert
      • Animate
      • Avatar
      • Badge
      • Breadcrumb
      • Button
      • Calendar
      • Card
      • Chart
      • Checklist
      • Credit Card
      • Detail
      • Dialog
      • Dropdown
      • Feedback
      • Form
      • Grid
      • Header
      • Helper
      • Icon
      • Image
      • Layout
      • Link
      • List
      • Loader
      • Logo
      • Nav
      • Onboarding
      • Pagination
      • Popover
      • Progress
      • Row
      • Search
      • Separator
      • Sheet
      • Social
      • Stat
      • Table
      • Tabs
      • Toast (Notification)
      • Tooltip
      • User
      • View
    • Views
    • Handling Errors
    • Deployment
  • Gravity Native
    • Introduction
    • Prerequisites
    • Installation
    • App Context
    • Authentication
    • Localisation
    • External Linking
    • Handling Errors
    • Navigation
    • Config
    • Events
    • Views
    • Components
      • Badge
      • Blankslate
      • Button
      • Card
      • Chart
      • Form
      • Global
      • Grid
      • Icon
      • List
      • Logo
      • Message
      • Modal
      • Nav
      • Notification
      • Progress Bar
      • Search
      • Separator
      • Social
      • Stat
      • View
    • Push Notifications
    • Payments
    • Building Your App
  • Mission Control
    • Introduction
    • Installation
    • User Management
    • Feedback
    • Events
    • Logs
  • Website Template
    • Introduction
    • Environment Variables
    • Styling
    • Components
      • Article
      • Feature List
      • Footer
      • Hero
      • Layout
      • Pricing
      • Meta Data
      • Nav
      • Testimonial
    • Build and Deploy
Powered by GitBook
On this page
  • Configuring Facebook
  • Configuring Twitter
  • Callback URLs
  • Adding More Networks
  • Disable the Social Sign-Ons
  • Using Social Sign Ons with Gravity Native

Was this helpful?

  1. Gravity Server
  2. Authentication

Social Sign On

PreviousEmail VerificationNextTwo-Factor Authentication

Last updated 9 months ago

Was this helpful?

In addition to enabling your users to sign on with their email and password, Gravity supports signing in with 500+ social networks using Social sign-ons are still tied to an email address, so users can sign in with multiple social accounts and be linked to one central account. Social accounts can even create a password and log in with an email/password combo or social login.

Configuring Facebook

In order to sign in with Facebook, you will need to create an app in the and add your app ID and secret to the .env file (you'll be asked to do this during setup, or you can add it manually later).

Please for the latest guidance on how to do this.

Configuring Twitter

As with Facebook, you will need to create an app in the and add your app ID and secret to the .env file.

Please for the latest guidance on how to do this.

Callback URLs

The default callback URLs are defined in the config file, and follow this structure:

http://localhost:8080/auth/facebook/callback

You will need to add the callback URL to the authorised endpoints in the developer portal for your chosen social network.

Adding More Networks

You can add support for additional social networks in three easy steps:

  1. Add the access keys to the .env file

  2. Add the Passport strategy in socialController.js

  3. Add the provider to socialController.js line 93:

    ...provider === 'google' && { google_id: profile.id },
  4. Add the provider to the user.create model:

    google_id: user.google_id,

Disable the Social Sign-Ons

If you'd like to disable social sign-ons, remove the <SocialSignin/> component from the auth views in the client to remove the buttons and then disable the endpoints in router.js on the server.

Using Social Sign Ons with Gravity Native

To use social sign-ons with Gravity Native on your mobile device, you will need to install ngrok instead of using localhost in your callback URLs.

Please update the callback_url inside the /config folder files and ALSO the baseURL value inside app/config.json

Please to set it up.

Passport.js
Facebook developer portal
follow the Facebook documentation
Twitter developer portal
follow the Twitter documentation
Install the relevant Passport strategy
follow the getting started guide on ngrok