I have gone through the existing threads and scraped together some info but am stuck due to lack of resources on custom auth.
I have setup the custom auth strategy and applied it to the media collection
import { Strategy } from 'passport-openidconnect';
const OktaAuthStrategy = new Strategy({
issuer: `${process.env.OKTA_OAUTH2_ISSUER}`,
authorizationURL: `https://${process.env.OKTA_DOMAIN}/oauth2/default/v1/authorize`,
tokenURL: `https://${process.env.OKTA_DOMAIN}/oauth2/default/v1/token`,
userInfoURL: `https://${process.env.OKTA_DOMAIN}/oauth2/default/v1/userinfo`,
clientID: `${process.env.OKTA_OAUTH2_CLIENT_ID}`,
clientSecret: `${process.env.OKTA_OAUTH2_CLIENT_SECRET}`,
callbackURL: 'http://localhost:3000/authorization-code/callback',
scope: 'openid profile email'
},
(issuer, profile, accessToken, refreshToken, done) => {
return done(null, profile);
}
);
export default OktaAuthStrategy;
Media collection auth config:
auth: {
disableLocalStrategy: true,
strategies: [
{
name: 'media-openidconnect',
strategy: OktaAuthStrategy
}
],
},
server.ts looks like the attached file to this post server.txt (due to char limit on post). I have followed the following article to setup okta auth using passport: https://developer.okta.com/blog/2018/05/18/node-authentication-with-passport-and-oidc
When I hit the login route I get back a res from okta and am redirected to /admin. However it fails to load throwing CORS for /init and /me routes. I assume for custom auth I'll have to implement those routes.
Can someone please guide me on what routes to override and other config required to setup okta as the login instead of the default payload login.