diff --git a/docs/developer-docs/latest/setup-deployment-guides/configurations/optional/sso.md b/docs/developer-docs/latest/setup-deployment-guides/configurations/optional/sso.md index ad6895b0f4..e0ec8ea69b 100644 --- a/docs/developer-docs/latest/setup-deployment-guides/configurations/optional/sso.md +++ b/docs/developer-docs/latest/setup-deployment-guides/configurations/optional/sso.md @@ -21,7 +21,7 @@ Single Sign-On on Strapi allows you to configure additional sign-in and sign-up It is currently not possible to associate a unique SSO provider to an email address used for a Strapi account, meaning that the access to a Strapi account cannot be restricted to only one SSO provider. For more information and workarounds to solve this issue, [please refer to the dedicated GitHub issue](https://github.com/strapi/strapi/issues/9466#issuecomment-783587648). ::: -SSO configuration lives in the server configuration of the application, found at `/config/server.js`. +SSO configuration lives in the server configuration of the application, found at `./config/admin.js`. ## Accessing the configuration @@ -59,9 +59,7 @@ The `uid` property is the unique identifier of each strategy and is generally fo A passport strategy is usually built by instantiating it using 2 parameters: the configuration object, and the verify function. - - -**Configuration Object** +#### Configuration Object The configuration object depends on the strategy needs, but often asks for a callback URL to be redirected to once the connection has been made on the provider side. @@ -132,7 +130,7 @@ yarn add passport-google-oauth2 ::: details Configuration example for Google: ```jsx -// path: ./config/server.js +// path: ./config/admin.js 'use strict'; @@ -201,7 +199,7 @@ yarn add passport-github2 ::: details Configuration example for Github: ```jsx -// path: ./config/server.js +// path: ./config/admin.js 'use strict'; @@ -265,7 +263,7 @@ yarn add passport-discord ::: details Configuration example for Discord: ```jsx -// path: ./config/server.js +// path: ./config/admin.js 'use strict'; @@ -329,7 +327,7 @@ yarn add passport-azure-ad-oauth2 jsonwebtoken ::: details Configuration example for Microsoft: ```jsx -// path: ./config/server.js +// path: ./config/admin.js 'use strict'; @@ -399,7 +397,7 @@ yarn add passport-okta-oauth20 ::: details Configuration example for Okta: ```jsx -// path: ./config/server.js +// path: ./config/admin.js 'use strict'; @@ -462,6 +460,8 @@ The easiest way to do so is to plug into the verify function of your strategy an For example, if you want to allow only people with an official strapi.io email address, you can instantiate your strategy like this: ```javascript +// path: ./config/admin.js + const strategyInstance = new Strategy(configuration, ({ email, username }, done) => { // If the email ends with @strapi.io if (email.endsWith('@strapi.io')) { @@ -476,16 +476,14 @@ const strategyInstance = new Strategy(configuration, ({ email, username }, done) ### Authentication Events -The SSO feature adds a new [authentication event](/developer-docs/latest/setup-deployment-guides/configurations/required/server.md#available-options): `onSSOAutoRegistration`. +The SSO feature adds a new [authentication event](/developer-docs/latest/setup-deployment-guides/configurations/required/admin-panel.md#available-options): `onSSOAutoRegistration`. This event is triggered whenever a user is created using the auto-register feature added by SSO. It contains the created user (`event.user`), and the provider used to make the registration (`event.provider`). -Example: - -`/config/server.js` - ```javascript +// path: ./config/admin.js + module.exports = () => ({ // ... admin: {