@@ -18,6 +18,7 @@ describe("Authentication Client", async () => {
18
18
clientSecret : "client-secret" ,
19
19
appBaseUrl : "https://example.com" ,
20
20
sid : "auth0-sid" ,
21
+ idToken : "idt_123" ,
21
22
accessToken : "at_123" ,
22
23
refreshToken : "rt_123" ,
23
24
sub : "user_123" ,
@@ -1827,6 +1828,7 @@ ca/T0LLtgmbMmxSv/MmzIg==
1827
1828
const session : SessionData = {
1828
1829
user : { sub : DEFAULT . sub } ,
1829
1830
tokenSet : {
1831
+ idToken : DEFAULT . idToken ,
1830
1832
accessToken : DEFAULT . accessToken ,
1831
1833
refreshToken : DEFAULT . refreshToken ,
1832
1834
expiresAt : 123456
@@ -1864,6 +1866,9 @@ ca/T0LLtgmbMmxSv/MmzIg==
1864
1866
expect ( authorizationUrl . searchParams . get ( "logout_hint" ) ) . toEqual (
1865
1867
DEFAULT . sid
1866
1868
) ;
1869
+ expect ( authorizationUrl . searchParams . get ( "id_token_hint" ) ) . toEqual (
1870
+ DEFAULT . idToken
1871
+ ) ;
1867
1872
1868
1873
// session cookie is cleared
1869
1874
const cookie = response . cookies . get ( "__session" ) ;
@@ -1941,6 +1946,43 @@ ca/T0LLtgmbMmxSv/MmzIg==
1941
1946
expect ( cookie ?. expires ) . toEqual ( new Date ( "1970-01-01T00:00:00.000Z" ) ) ;
1942
1947
} ) ;
1943
1948
1949
+ it ( "should not include the id_token_hint parameter if a session does not exist" , async ( ) => {
1950
+ const secret = await generateSecret ( 32 ) ;
1951
+ const transactionStore = new TransactionStore ( {
1952
+ secret
1953
+ } ) ;
1954
+ const sessionStore = new StatelessSessionStore ( {
1955
+ secret
1956
+ } ) ;
1957
+ const authClient = new AuthClient ( {
1958
+ transactionStore,
1959
+ sessionStore,
1960
+
1961
+ domain : DEFAULT . domain ,
1962
+ clientId : DEFAULT . clientId ,
1963
+ clientSecret : DEFAULT . clientSecret ,
1964
+
1965
+ secret,
1966
+ appBaseUrl : DEFAULT . appBaseUrl ,
1967
+
1968
+ fetch : getMockAuthorizationServer ( )
1969
+ } ) ;
1970
+
1971
+ const request = new NextRequest (
1972
+ new URL ( "/auth/logout" , DEFAULT . appBaseUrl ) ,
1973
+ {
1974
+ method : "GET"
1975
+ }
1976
+ ) ;
1977
+
1978
+ const response = await authClient . handleLogout ( request ) ;
1979
+ expect ( response . status ) . toEqual ( 307 ) ;
1980
+ expect ( response . headers . get ( "Location" ) ) . not . toBeNull ( ) ;
1981
+
1982
+ const authorizationUrl = new URL ( response . headers . get ( "Location" ) ! ) ;
1983
+ expect ( authorizationUrl . searchParams . get ( "id_token_hint" ) ) . toBeNull ( ) ;
1984
+ } ) ;
1985
+
1944
1986
it ( "should not include the logout_hint parameter if a session does not exist" , async ( ) => {
1945
1987
const secret = await generateSecret ( 32 ) ;
1946
1988
const transactionStore = new TransactionStore ( {
0 commit comments