File tree Expand file tree Collapse file tree 12 files changed +99
-98
lines changed Expand file tree Collapse file tree 12 files changed +99
-98
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ services:
31
31
NEXT_PUBLIC_METABASE_INSTANCE_URL : " http://localhost:${MB_PORT}"
32
32
METABASE_INSTANCE_URL : " http://metabase:${MB_PORT}"
33
33
METABASE_JWT_SHARED_SECRET : " ${METABASE_JWT_SHARED_SECRET}"
34
- WATCH : ' ${WATCH}'
34
+ WATCH : " ${WATCH}"
35
35
environment :
36
36
PORT : " ${CLIENT_PORT_APP_ROUTER}"
37
37
NEXT_PUBLIC_METABASE_INSTANCE_URL : " http://localhost:${MB_PORT}"
@@ -54,7 +54,7 @@ services:
54
54
NEXT_PUBLIC_METABASE_INSTANCE_URL : " http://localhost:${MB_PORT}"
55
55
METABASE_INSTANCE_URL : " http://metabase:${MB_PORT}"
56
56
METABASE_JWT_SHARED_SECRET : " ${METABASE_JWT_SHARED_SECRET}"
57
- WATCH : ' ${WATCH}'
57
+ WATCH : " ${WATCH}"
58
58
environment :
59
59
PORT : " ${CLIENT_PORT_PAGES_ROUTER}"
60
60
NEXT_PUBLIC_METABASE_INSTANCE_URL : " http://localhost:${MB_PORT}"
@@ -63,4 +63,4 @@ services:
63
63
ports :
64
64
- " ${CLIENT_PORT_PAGES_ROUTER}:${CLIENT_PORT_PAGES_ROUTER}"
65
65
volumes :
66
- - ./next-sample-pages-router/src:/app/next-sample-pages-router/src
66
+ - ./next-sample-pages-router/src:/app/next-sample-pages-router/src
Original file line number Diff line number Diff line change 1
- FROM metabase/metabase-enterprise:v1.54 .x
1
+ FROM metabase/metabase-enterprise:v1.55 .x
2
2
3
3
COPY ./metabase /app/
4
4
COPY ./local-dist /app/local-dist
Original file line number Diff line number Diff line change 9
9
"lint" : " next lint"
10
10
},
11
11
"dependencies" : {
12
- "@metabase/embedding-sdk-react" : " ^0.54.11 " ,
12
+ "@metabase/embedding-sdk-react" : " ^0.55.2-nightly " ,
13
13
"dotenv-cli" : " ^8.0.0" ,
14
14
"jsonwebtoken" : " ^9.0.2" ,
15
15
"next" : " 14.2.18" ,
Original file line number Diff line number Diff line change 1
1
import jwt from "jsonwebtoken" ;
2
+ import { NextResponse } from 'next/server' ;
2
3
3
4
if ( ! process . env . METABASE_JWT_SHARED_SECRET ) {
4
5
throw new Error ( "Missing METABASE_JWT_SHARED_SECRET" ) ;
@@ -10,7 +11,7 @@ if (!process.env.NEXT_PUBLIC_METABASE_INSTANCE_URL) {
10
11
const METABASE_JWT_SHARED_SECRET = process . env . METABASE_JWT_SHARED_SECRET ;
11
12
const METABASE_INSTANCE_URL = process . env . METABASE_INSTANCE_URL ;
12
13
13
- export async function GET ( ) {
14
+ export async function GET ( req : Request ) {
14
15
// this should come from the session
15
16
const user = {
16
17
@@ -30,7 +31,14 @@ export async function GET() {
30
31
METABASE_JWT_SHARED_SECRET
31
32
) ;
32
33
33
- const ssoUrl = `${ METABASE_INSTANCE_URL } /auth/sso?token=true&jwt=${ token } ` ;
34
+ const url = new URL ( req . url )
35
+ const wantsJson = url . searchParams . get ( 'response' ) === 'json'
36
+
37
+ if ( wantsJson ) {
38
+ return NextResponse . json ( { jwt : token } )
39
+ }
40
+
41
+ const ssoUrl = `${ METABASE_INSTANCE_URL } /auth/sso?jwt=${ token } ` ;
34
42
35
43
try {
36
44
const response = await fetch ( ssoUrl ) ;
Original file line number Diff line number Diff line change 3
3
import {
4
4
MetabaseProvider ,
5
5
defineMetabaseAuthConfig ,
6
- defineMetabaseTheme
7
- } from ' @metabase/embedding-sdk-react/nextjs' ;
8
- import { PropsWithChildren } from ' react' ;
6
+ defineMetabaseTheme ,
7
+ } from " @metabase/embedding-sdk-react/nextjs" ;
8
+ import { PropsWithChildren } from " react" ;
9
9
10
10
if ( ! process . env . NEXT_PUBLIC_METABASE_INSTANCE_URL ) {
11
11
throw new Error ( "Missing NEXT_PUBLIC_METABASE_INSTANCE_URL" ) ;
12
12
}
13
13
14
14
const authConfig = defineMetabaseAuthConfig ( {
15
15
metabaseInstanceUrl : process . env . NEXT_PUBLIC_METABASE_INSTANCE_URL ,
16
- authProviderUri : `/api/metabase/auth` ,
16
+ fetchRequestToken : async ( ) => {
17
+ const response = await fetch ( '/api/metabase/auth?response=json' , {
18
+ method : "GET" ,
19
+ credentials : "include" ,
20
+ } ) ;
21
+
22
+ return await response . json ( ) ;
23
+ } ,
17
24
} ) ;
18
25
19
26
const theme = defineMetabaseTheme ( {
@@ -57,11 +64,8 @@ const theme = defineMetabaseTheme({
57
64
} ,
58
65
} ) ;
59
66
60
- export const AppProvider = ( { children} : PropsWithChildren ) => (
61
- < MetabaseProvider
62
- authConfig = { authConfig }
63
- theme = { theme }
64
- >
67
+ export const AppProvider = ( { children } : PropsWithChildren ) => (
68
+ < MetabaseProvider authConfig = { authConfig } theme = { theme } >
65
69
{ children }
66
70
</ MetabaseProvider >
67
- )
71
+ ) ;
Original file line number Diff line number Diff line change @@ -3,8 +3,8 @@ import type { Metadata } from "next";
3
3
import localFont from "next/font/local" ;
4
4
import "./globals.css" ;
5
5
import Link from "next/link" ;
6
- import { AppProvider } from ' @/app/app-provider' ;
7
- import { Suspense } from ' react' ;
6
+ import { AppProvider } from " @/app/app-provider" ;
7
+ import { Suspense } from " react" ;
8
8
9
9
const geistSans = localFont ( {
10
10
src : "./fonts/GeistVF.woff" ,
Original file line number Diff line number Diff line change 9
9
"lint" : " next lint"
10
10
},
11
11
"dependencies" : {
12
- "@metabase/embedding-sdk-react" : " ^0.54.11 " ,
12
+ "@metabase/embedding-sdk-react" : " ^0.55.2-nightly " ,
13
13
"dotenv-cli" : " ^8.0.0" ,
14
14
"jsonwebtoken" : " ^9.0.2" ,
15
15
"next" : " 14.2.18" ,
Original file line number Diff line number Diff line change @@ -11,7 +11,14 @@ if (!process.env.NEXT_PUBLIC_METABASE_INSTANCE_URL) {
11
11
12
12
const authConfig = defineMetabaseAuthConfig ( {
13
13
metabaseInstanceUrl : process . env . NEXT_PUBLIC_METABASE_INSTANCE_URL ,
14
- authProviderUri : `/api/metabase/auth` ,
14
+ fetchRequestToken : async ( ) => {
15
+ const response = await fetch ( '/api/metabase/auth?response=json' , {
16
+ method : "GET" ,
17
+ credentials : "include" ,
18
+ } ) ;
19
+
20
+ return await response . json ( ) ;
21
+ } ,
15
22
} ) ;
16
23
17
24
const theme = defineMetabaseTheme ( {
You can’t perform that action at this time.
0 commit comments