0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00
logto/packages/connector-facebook
2022-06-30 00:01:55 +08:00
..
docs chore(connectors): config template md files to json files (#987) 2022-05-31 12:58:24 +08:00
src refactor(connector-*): load config template and readme contents while initialization (#1252) 2022-06-27 10:00:37 +08:00
jest.config.ts refactor: use @silverhand/jest-config (#861) 2022-05-17 17:32:41 +08:00
logo.svg feat(core): serve connector logo (#931) 2022-05-24 13:54:37 +08:00
package.json refactor(connector-*): load config template and readme contents while initialization (#1252) 2022-06-27 10:00:37 +08:00
README.md docs(connector-aliyun-dm): add Aliyun DM README.md (en-US) (#1263) 2022-06-30 00:01:55 +08:00
tsconfig.base.json feat(core): wrap facebook connector (#672) 2022-04-27 12:48:42 +08:00
tsconfig.build.json feat(core): wrap facebook connector (#672) 2022-04-27 12:48:42 +08:00
tsconfig.json feat(core): wrap facebook connector (#672) 2022-04-27 12:48:42 +08:00
tsconfig.test.json test: allow JS in tests (#903) 2022-05-20 13:02:36 +08:00

Facebook connector

The Facebook connector provides a concise way for your application to use Facebook's OAuth 2.0 authentication system.

Register a Facebook developer account

Register as a Facebook Developer if you don't already have one

Set up a Facebook app

  1. Visit the Apps page.
  2. Click your existing app or create a new one if needed.
    • The selected app type is up to you, but it should have the product Facebook Login.
  3. On the app dashboard page, scroll to the Add a product section and click the Set up button on the Facebook Login card.
  4. Skip the Facebook Login Quickstart page, and click the sidebar -> Products -> Facebook Login -> Settings.
  5. In the Facebook Login Settings page, fill ${your_logto_origin}/callback/facebook-universal in the Valid OAuth Redirect URIs field. E.g.:
    • https://logto.dev/callback/facebook-universal for production
    • https://localhost:3001/callback/facebook-universal for testing in the local environment
  6. Click the Save changes button at the bottom right corner.

Set up the Logto connector settings

  1. In the Facebook app dashboard page, click the sidebar -> Settings -> Basic.
  2. You will see the App ID and App secret on the panel.
  3. Click the Show button following the App secret input box to copy its content.
  4. Fill out the Logto connector settings:
    • Fill out the clientId field with the string from App ID.
    • Fill out the clientSecret field with the string from App secret.

Config types

Name Type
clientId string
clientSecret string

Debug sign-in with the test users

You can use the accounts of the test, developer, and admin users to test sign-in with the related app under both development and live app modes.

You can also take the app live directly so that any Facebook user can sign in with the app.

  • In the app dashboard page, click the sidebar -> Roles -> Test Users.
  • Click the Create test users button to create a testing user while testing.
  • Click the Options button of the existing test user, and you will see more operations, e.g., "Change name and password".

Take the Facebook app live

Usually, only the test, admin, and developer users can sign in with the related app under development mode.

To enable normal Facebook users sign-in with the app in the production environment, you maybe need to switch your Facebook app to live mode, depending on the app type. E.g., the pure business type app doesn't have the live switch button, but it won't block your use.

  1. In the Facebook app dashboard page, click the sidebar -> Settings -> Basic.
  2. Fill out the Privacy Policy URL and User data deletion fields on the panel if required.
  3. Click the Save changes button at the bottom right corner.
  4. Click the Live switch button on the app top bar.

References