File tree Expand file tree Collapse file tree
apps/sim/app/api/credential-groups/enroll/[token]/oauth/[optionId] Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -69,13 +69,16 @@ describe('credential group OAuth start route', () => {
6969 } )
7070 } )
7171
72- it ( 'returns the same 404 for an unavailable enrollment or option ' , async ( ) => {
72+ it ( 'returns an unavailable enrollment to its public page ' , async ( ) => {
7373 mocks . authenticate . mockResolvedValue ( null )
7474
7575 const response = await GET ( request ( ) , context )
7676
77- expect ( response . status ) . toBe ( 404 )
78- await expect ( response . json ( ) ) . resolves . toEqual ( { error : 'Not found' } )
77+ expect ( response . status ) . toBe ( 307 )
78+ expect ( response . headers . get ( 'location' ) ) . toBe (
79+ '/credential-groups/enroll/invitation-token?oauth=unavailable'
80+ )
81+ expect ( response . headers . get ( 'cache-control' ) ) . toBe ( 'no-store' )
7982 expect ( mocks . startOAuth ) . not . toHaveBeenCalled ( )
8083 } )
8184
Original file line number Diff line number Diff line change @@ -32,10 +32,7 @@ export const GET = withRouteHandler(
3232 const { token, optionId } = parsed . data . params
3333 const principal = await authenticateCredentialGroupEnrollment ( token )
3434 if ( ! principal ) {
35- return NextResponse . json (
36- { error : 'Not found' } ,
37- { status : 404 , headers : { 'Cache-Control' : 'no-store' } }
38- )
35+ return createCredentialGroupEnrollmentRedirect ( token , { oauth : 'unavailable' } )
3936 }
4037
4138 const enrollmentLimited = await enforceCredentialGroupEnrollmentOAuthRateLimit (
You can’t perform that action at this time.
0 commit comments