miolo 3.0.0-beta.201 → 3.0.0-beta.203

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miolo",
3
- "version": "3.0.0-beta.201",
3
+ "version": "3.0.0-beta.203",
4
4
  "description": "all-in-one koa-based server",
5
5
  "author": "Donato Lorenzo <donato@afialapis.com>",
6
6
  "contributors": [
@@ -390,7 +390,7 @@ export default function make_config_defaults() {
390
390
  // err => done(error, null)
391
391
  // local_url_login : '/login',
392
392
  // local_url_logout: '/logout',
393
- // local_url_login_redirect: undefined
393
+ // local_url_login_redirect: '/
394
394
  // local_url_logout_redirect: '/'
395
395
  // google_auth_user: (accessToken, refreshToken, profile, done, ctx) => done(null, {id: 1})
396
396
  // auth => done(null, user)
@@ -247,9 +247,22 @@ const init_passport_auth_middleware = (app, options, sessionConfig, cacheConfig)
247
247
  }
248
248
 
249
249
  // handle auth routes
250
- const handleGoogleLogin = passport.authenticate("google", {
251
- scope: ["profile", "email"]
252
- })
250
+ const handleGoogleLogin = (ctx, next) => {
251
+ ctx.miolo.logger.debug(`[auth][google] handleGoogleLogin() - authenticating...`)
252
+
253
+ const redirectUrl = ctx.query.redirect || "/"
254
+
255
+ ctx.miolo.logger.info(
256
+ `[auth][google] handleGoogleLogin() - authenticating with redirectUrl: ${redirectUrl}`
257
+ )
258
+
259
+ const strategy = passport.authenticate("google", {
260
+ scope: ["profile", "email"],
261
+ state: redirectUrl
262
+ })
263
+
264
+ return strategy(ctx, next)
265
+ }
253
266
 
254
267
  const handleGoogleCallback = (ctx, next) => {
255
268
  ctx.miolo.logger.debug(`[auth][google] handleGoogleCallback() - authenticating...`)
@@ -284,20 +297,24 @@ const init_passport_auth_middleware = (app, options, sessionConfig, cacheConfig)
284
297
  ctx.session.authenticated = true
285
298
  ctx.session.auth_method = "google"
286
299
 
287
- ctx.body = {
288
- ok: true,
289
- data: {
290
- user: user,
291
- authenticated: true,
292
- config: {
293
- auth_method: "google"
294
- }
295
- }
296
- }
300
+ // ctx.body = {
301
+ // ok: true,
302
+ // data: {
303
+ // user: user,
304
+ // authenticated: true,
305
+ // config: {
306
+ // auth_method: "google"
307
+ // }
308
+ // }
309
+ // }
297
310
 
298
- if (google_url_login_redirect !== undefined) {
299
- ctx.redirect(google_url_login_redirect)
300
- }
311
+ const redirectUrl = ctx.query.state || google_url_login_redirect || "/"
312
+
313
+ ctx.miolo.logger.info(
314
+ `[auth][google] handleGoogleCallback() - redirecting to: ${redirectUrl}. query.state: ${ctx.query.state}. google_url_login_redirect: ${google_url_login_redirect}`
315
+ )
316
+
317
+ ctx.redirect(redirectUrl)
301
318
  }
302
319
  })(ctx, next)
303
320
  }
@@ -45,9 +45,9 @@
45
45
  "intre": "^3.0.0-beta.4",
46
46
  "joi": "^18.2.1",
47
47
  "lucide-react": "^1.16.0",
48
- "miolo-cli": "^3.0.0-beta.201",
48
+ "miolo-cli": "^3.0.0-beta.203",
49
49
  "miolo-model": "file:../miolo-model",
50
- "miolo-react": "^3.0.0-beta.201",
50
+ "miolo-react": "^3.0.0-beta.203",
51
51
  "next-themes": "^0.4.6",
52
52
  "radix-ui": "^1.4.3",
53
53
  "react": "^19.2.6",
@@ -62,7 +62,7 @@
62
62
  },
63
63
  "devDependencies": {
64
64
  "@biomejs/biome": "2.4.15",
65
- "miolo": "^3.0.0-beta.201",
65
+ "miolo": "^3.0.0-beta.203",
66
66
  "sass-embedded": "^1.99.0"
67
67
  },
68
68
  "overrides": {