Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 1.27 KB

authentication.md

File metadata and controls

18 lines (14 loc) · 1.27 KB

Authentication

Social authentication uses the Strapi users-permissions provider flow. Enable GitHub and configure its client ID, client secret, and callback URL in the Users & Permissions plugin provider settings. The callback URL must match the URL generated by Strapi for the deployment (for example, https://api.example.com/api/auth/github/callback).

The client starts authentication through GET /api/connect/github. GitHub then redirects to Strapi's GET /api/auth/github/callback; Strapi exchanges the authorization result, retrieves the GitHub profile, creates or finds the users-permissions user, and returns a JWT and user object. GitHub must provide an email address because Strapi uses it to find existing accounts.

Legacy GitHub accounts were represented by rows in the custom providers collection. Migration 5.3.0 sets the linked users-permissions users' provider field to github, which lets Strapi's built-in callback reuse those same users and retain their IDs and application relations. The migration deliberately keeps the legacy provider rows and their stored data; it does not delete or recreate accounts.

The integration test exercises Strapi's callback route while replacing the provider registry profile lookup with a local mock, so it does not call GitHub.