Skip to content

Commit 9f96c78

Browse files
authored
Merge pull request #17 from Samtropic/main
Add config option to define a redirection path for the authenticated user
2 parents 3c0ea2d + be35d8b commit 9f96c78

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const CLIENTSIDE = typeof session !== 'function'
3434
* ```
3535
* export function mijnNederlandsAuth() {
3636
* return oAuthPlugin({
37-
* mongoUrl: process.env.MONGO_URL,
37+
* databaseUri: process.env.MONGO_URL,
3838
* clientID: process.env.OAUTH_CLIENT_ID,
3939
* clientSecret: process.env.OAUTH_CLIENT_SECRET,
4040
* authorizationURL: process.env.OAUTH_SERVER + '/oauth/authorize',
@@ -306,8 +306,9 @@ function oAuthPluginServer(
306306
domain: collectionConfig.auth.cookies.domain || undefined,
307307
})
308308

309-
// Redirect to admin dashboard
310-
res.redirect('/admin')
309+
// Redirect to the defined path or default to the admin dashboard
310+
const userRedirectionPath = options.userRedirectionPath || '/admin'
311+
res.redirect(userRedirectionPath)
311312
},
312313
},
313314
]),

src/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,6 @@ export interface oAuthPluginOptions extends StrategyOptions {
5858
/** Defaults to "sub" */
5959
name?: string
6060
}
61+
/** Which path to redirect the authenticated user to, redirects to /admin by default */
62+
userRedirectionPath?: string
6163
}

0 commit comments

Comments
 (0)