Created
August 26, 2021 17:07
-
-
Save derrickmehaffy/cc3105c038563900d88bbade9b71835e to your computer and use it in GitHub Desktop.
Okta config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const OktaOAuth2Strategy = require("passport-okta-oauth20").Strategy; | |
| module.exports = ({ env }) => ({ | |
| host: env("HOST", "0.0.0.0"), | |
| port: env.int("PORT", 1337), | |
| // url: env("STRAPI_URL") // This is recommended for production, should be your public URL for Strapi | |
| admin: { | |
| auth: { | |
| secret: env("ADMIN_JWT_SECRET", "7531cd15e67d954d60126ecb4736086a"), | |
| providers: [ | |
| { | |
| uid: "okta", | |
| displayName: "Okta", | |
| icon: "https://www.okta.com/sites/default/files/Okta_Logo_BrightBlue_Medium-thumbnail.png", | |
| createStrategy: (strapi) => | |
| new OktaOAuth2Strategy( | |
| { | |
| clientID: env("OKTA_CLIENT_ID"), | |
| clientSecret: env("OKTA_CLIENT_SECRET"), | |
| audience: env("OKTA_DOMAIN"), | |
| scope: ["openid", "email", "profile"], | |
| callbackURL: | |
| strapi.admin.services.passport.getStrategyCallbackURL("okta"), | |
| }, | |
| (accessToken, refreshToken, profile, done) => { | |
| done(null, { | |
| // Email is required | |
| // You need either Username OR First + Last Name | |
| email: profile.email, | |
| username: profile.username, | |
| firstname: profile.givenName, // optional if you have username | |
| lastname: profile.familyName, // optional if you have username | |
| }); | |
| } | |
| ), | |
| }, | |
| ], | |
| }, | |
| }, | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment