File tree Expand file tree Collapse file tree 8 files changed +16
-59
lines changed
Expand file tree Collapse file tree 8 files changed +16
-59
lines changed Original file line number Diff line number Diff line change @@ -58,19 +58,11 @@ export async function GET(request: NextRequest) {
5858 return NextResponse . json ( { error : 'Credential not found' } , { status : 404 } )
5959 }
6060
61- const credential = credentials [ 0 ]
62-
63- if ( credential . userId !== session . user . id ) {
64- logger . warn ( `[${ requestId } ] Unauthorized credential access attempt` , {
65- credentialUserId : credential . userId ,
66- requestUserId : session . user . id ,
67- } )
68- return NextResponse . json ( { error : 'Unauthorized' } , { status : 403 } )
69- }
61+ const accountRow = credentials [ 0 ]
7062
7163 const accessToken = await refreshAccessTokenIfNeeded (
7264 resolved . accountId ,
73- session . user . id ,
65+ accountRow . userId ,
7466 requestId
7567 )
7668
Original file line number Diff line number Diff line change @@ -60,18 +60,11 @@ export async function GET(request: NextRequest) {
6060 return NextResponse . json ( { error : 'Credential not found' } , { status : 404 } )
6161 }
6262
63- const credential = credentials [ 0 ]
64- if ( credential . userId !== session . user . id ) {
65- logger . warn ( `[${ requestId } ] Unauthorized credential access attempt` , {
66- credentialUserId : credential . userId ,
67- requestUserId : session . user . id ,
68- } )
69- return NextResponse . json ( { error : 'Unauthorized' } , { status : 403 } )
70- }
63+ const accountRow = credentials [ 0 ]
7164
7265 const accessToken = await refreshAccessTokenIfNeeded (
7366 resolved . accountId ,
74- session . user . id ,
67+ accountRow . userId ,
7568 requestId
7669 )
7770 if ( ! accessToken ) {
Original file line number Diff line number Diff line change @@ -48,14 +48,11 @@ export async function GET(request: NextRequest) {
4848 return NextResponse . json ( { error : 'Credential not found' } , { status : 404 } )
4949 }
5050
51- const credential = credentials [ 0 ]
52- if ( credential . userId !== session . user . id ) {
53- return NextResponse . json ( { error : 'Unauthorized' } , { status : 403 } )
54- }
51+ const accountRow = credentials [ 0 ]
5552
5653 const accessToken = await refreshAccessTokenIfNeeded (
5754 resolved . accountId ,
58- session . user . id ,
55+ accountRow . userId ,
5956 requestId
6057 )
6158 if ( ! accessToken ) {
Original file line number Diff line number Diff line change @@ -54,14 +54,11 @@ export async function GET(request: NextRequest) {
5454 return NextResponse . json ( { error : 'Credential not found' } , { status : 404 } )
5555 }
5656
57- const credential = credentials [ 0 ]
58- if ( credential . userId !== session . user . id ) {
59- return NextResponse . json ( { error : 'Unauthorized' } , { status : 403 } )
60- }
57+ const accountRow = credentials [ 0 ]
6158
6259 const accessToken = await refreshAccessTokenIfNeeded (
6360 resolved . accountId ,
64- session . user . id ,
61+ accountRow . userId ,
6562 requestId
6663 )
6764 if ( ! accessToken ) {
Original file line number Diff line number Diff line change @@ -48,14 +48,11 @@ export async function GET(request: NextRequest) {
4848 return NextResponse . json ( { error : 'Credential not found' } , { status : 404 } )
4949 }
5050
51- const credential = credentials [ 0 ]
52- if ( credential . userId !== session . user . id ) {
53- return NextResponse . json ( { error : 'Unauthorized' } , { status : 403 } )
54- }
51+ const accountRow = credentials [ 0 ]
5552
5653 const accessToken = await refreshAccessTokenIfNeeded (
5754 resolved . accountId ,
58- session . user . id ,
55+ accountRow . userId ,
5956 requestId
6057 )
6158 if ( ! accessToken ) {
Original file line number Diff line number Diff line change @@ -53,14 +53,11 @@ export async function GET(request: NextRequest) {
5353 return NextResponse . json ( { error : 'Credential not found' } , { status : 404 } )
5454 }
5555
56- const credential = credentials [ 0 ]
57- if ( credential . userId !== session . user . id ) {
58- return NextResponse . json ( { error : 'Unauthorized' } , { status : 403 } )
59- }
56+ const accountRow = credentials [ 0 ]
6057
6158 const accessToken = await refreshAccessTokenIfNeeded (
6259 resolved . accountId ,
63- session . user . id ,
60+ accountRow . userId ,
6461 requestId
6562 )
6663 if ( ! accessToken ) {
Original file line number Diff line number Diff line change @@ -80,19 +80,11 @@ export async function GET(request: NextRequest) {
8080 return NextResponse . json ( { error : 'Credential not found' } , { status : 404 } )
8181 }
8282
83- const credential = credentials [ 0 ]
84-
85- if ( credential . userId !== session . user . id ) {
86- logger . warn ( `[${ requestId } ] Unauthorized credential access attempt` , {
87- credentialUserId : credential . userId ,
88- requestUserId : session . user . id ,
89- } )
90- return NextResponse . json ( { error : 'Unauthorized' } , { status : 403 } )
91- }
83+ const accountRow = credentials [ 0 ]
9284
9385 const accessToken = await refreshAccessTokenIfNeeded (
9486 resolved . accountId ,
95- session . user . id ,
87+ accountRow . userId ,
9688 requestId
9789 )
9890
Original file line number Diff line number Diff line change @@ -80,19 +80,11 @@ export async function GET(request: NextRequest) {
8080 return NextResponse . json ( { error : 'Credential not found' } , { status : 404 } )
8181 }
8282
83- const credential = credentials [ 0 ]
84-
85- if ( credential . userId !== session . user . id ) {
86- logger . warn ( `[${ requestId } ] Unauthorized credential access attempt` , {
87- credentialUserId : credential . userId ,
88- requestUserId : session . user . id ,
89- } )
90- return NextResponse . json ( { error : 'Unauthorized' } , { status : 403 } )
91- }
83+ const accountRow = credentials [ 0 ]
9284
9385 const accessToken = await refreshAccessTokenIfNeeded (
9486 resolved . accountId ,
95- session . user . id ,
87+ accountRow . userId ,
9688 requestId
9789 )
9890
You can’t perform that action at this time.
0 commit comments