@@ -27,7 +27,7 @@ const HOOK_NAME = 'useOAuthConsent';
2727export function useOAuthConsent ( params : UseOAuthConsentParams ) : UseOAuthConsentReturn {
2828 useAssertWrappedByClerkProvider ( HOOK_NAME ) ;
2929
30- const { oauthClientId : oauthClientIdParam , scope, keepPreviousData = true , enabled = true } = params ;
30+ const { oauthClientId : oauthClientIdParam , scope, redirectUri , keepPreviousData = true , enabled = true } = params ;
3131 const clerk = useClerkInstanceContext ( ) ;
3232 const user = useUserBase ( ) ;
3333
@@ -39,14 +39,15 @@ export function useOAuthConsent(params: UseOAuthConsentParams): UseOAuthConsentR
3939 userId : user ?. id ?? null ,
4040 oauthClientId,
4141 scope,
42+ redirectUri,
4243 } ) ;
4344
4445 const hasClientId = oauthClientId . length > 0 ;
4546 const queryEnabled = Boolean ( user ) && hasClientId && enabled && clerk . loaded ;
4647
4748 const query = useClerkQuery ( {
4849 queryKey,
49- queryFn : ( ) => fetchConsentInfo ( clerk , { oauthClientId, scope } ) ,
50+ queryFn : ( ) => fetchConsentInfo ( clerk , { oauthClientId, scope, redirectUri } ) ,
5051 enabled : queryEnabled ,
5152 placeholderData : defineKeepPreviousDataFn ( keepPreviousData && queryEnabled ) ,
5253 } ) ;
@@ -59,7 +60,6 @@ export function useOAuthConsent(params: UseOAuthConsentParams): UseOAuthConsentR
5960 } ;
6061}
6162
62- function fetchConsentInfo ( clerk : LoadedClerk , params : { oauthClientId : string ; scope ?: string } ) {
63- const { oauthClientId, scope } = params ;
64- return clerk . oauthApplication . getConsentInfo ( scope !== undefined ? { oauthClientId, scope } : { oauthClientId } ) ;
63+ function fetchConsentInfo ( clerk : LoadedClerk , params : { oauthClientId : string ; scope ?: string ; redirectUri ?: string } ) {
64+ return clerk . oauthApplication . getConsentInfo ( params ) ;
6565}
0 commit comments