MCPcopy Create free account
hub / github.com/simstudioai/sim / useOAuthCredentials

Function useOAuthCredentials

apps/sim/hooks/queries/oauth/oauth-credentials.ts:87–107  ·  view source on GitHub ↗
(
  providerId?: string,
  enabledOrOptions?: boolean | UseOAuthCredentialsOptions
)

Source from the content-addressed store, hash-verified

85}
86
87export function useOAuthCredentials(
88 providerId?: string,
89 enabledOrOptions?: boolean | UseOAuthCredentialsOptions
90) {
91 const { enabled, workspaceId, workflowId } = resolveOptions(enabledOrOptions)
92
93 return useQuery<Credential[]>({
94 queryKey: oauthCredentialKeys.list(providerId, workspaceId, workflowId),
95 queryFn: ({ signal }) =>
96 fetchOAuthCredentials(
97 {
98 providerId: providerId ?? '',
99 workspaceId: workspaceId || undefined,
100 workflowId: workflowId || undefined,
101 },
102 signal
103 ),
104 enabled: Boolean(providerId) && enabled,
105 staleTime: 60 * 1000,
106 })
107}
108
109export function useOAuthCredentialDetail(
110 credentialId?: string,

Callers 5

AddConnectorModalFunction · 0.90
ConnectorCardFunction · 0.90
ToolCredentialSelectorFunction · 0.90
CredentialSelectorFunction · 0.90
useCredentialNameFunction · 0.85

Calls 2

fetchOAuthCredentialsFunction · 0.85
resolveOptionsFunction · 0.70

Tested by

no test coverage detected