README
Agent Runtimes / identity
identity
Identity module for OAuth 2.1 user-delegated access.
Provides secure identity management for AI agents to access external services like GitHub, Google, Kaggle, etc.
Built-in provider support:
- GitHub: OAuth 2.1 with PKCE (requires client_secret server-side)
- Google: OAuth 2.1 with PKCE and offline access
- Kaggle: Standard OAuth 2.1 for MCP server access
Provider-specific notes:
- GitHub requires
client_secretfor token exchange even with PKCE - GitHub returns user info from
https://api.github.com/userwithlogin,avatar_urlfields - Google supports pure PKCE without client_secret
- All providers need backend proxy for token exchange due to CORS restrictions
Example
import { useIdentity } from '@datalayer/agent-runtimes';
function MyComponent() {
const { connect, disconnect, isConnected, identities } = useIdentity({
providers: {
github: { clientId: 'your-github-client-id' },
},
});
return (
<button onClick={() => connect('github', ['repo'])}>
{isConnected('github') ? 'Disconnect GitHub' : 'Connect GitHub'}
</button>
);
}
References
AgentIdentity
Re-exports AgentIdentity
AgentIdentityProps
Re-exports AgentIdentityProps
AuthorizationCallback
Re-exports AuthorizationCallback
AuthorizationRequest
Re-exports AuthorizationRequest
AuthorizationServerMetadata
Re-exports AuthorizationServerMetadata
AuthType
Re-exports AuthType
clearAllDynamicClients
Re-exports clearAllDynamicClients
ClientRegistrationError
Re-exports ClientRegistrationError
ClientRegistrationRequest
Re-exports ClientRegistrationRequest
ClientRegistrationResponse
Re-exports ClientRegistrationResponse
configureBuiltinProviders
Re-exports configureBuiltinProviders
deleteClientRegistration
Re-exports deleteClientRegistration
discoverAuthorizationServer
Re-exports discoverAuthorizationServer
DynamicClient
Re-exports DynamicClient
dynamicClientToProviderConfig
Re-exports dynamicClientToProviderConfig
formatDuration
Re-exports formatDuration
formatExpirationStatus
Re-exports formatExpirationStatus
generateCodeChallenge
Re-exports generateCodeChallenge
generateCodeVerifier
Re-exports generateCodeVerifier
generatePKCEPair
Re-exports generatePKCEPair
generateState
Re-exports generateState
getAllDynamicClients
Re-exports getAllDynamicClients
getOrCreateDynamicClient
Re-exports getOrCreateDynamicClient
getTokenStatus
Re-exports getTokenStatus
GITHUB_PROVIDER
Re-exports GITHUB_PROVIDER
GOOGLE_PROVIDER
Re-exports GOOGLE_PROVIDER
Identity
Re-exports Identity
IdentityActions
Re-exports IdentityActions
IdentityButton
Re-exports IdentityButton
IdentityButtonProps
Re-exports IdentityButtonProps
IdentityCard
Re-exports IdentityCard
IdentityCardProps
Re-exports IdentityCardProps
IdentityConnect
Re-exports IdentityConnect
IdentityConnectProps
Re-exports IdentityConnectProps
IdentityMenu
Re-exports IdentityMenu
IdentityMenuProps
Re-exports IdentityMenuProps
IdentityProviderConfig
Re-exports IdentityProviderConfig
IdentityProvidersConfig
Re-exports IdentityProvidersConfig
IdentityState
Re-exports IdentityState
IdentityStore
Re-exports IdentityStore
KAGGLE_PROVIDER
Re-exports KAGGLE_PROVIDER
KAGGLE_TOKEN_PROVIDER
Re-exports KAGGLE_TOKEN_PROVIDER
loadDynamicClient
Re-exports loadDynamicClient
OAuthCallback
Re-exports OAuthCallback
OAuthCallbackProps
Re-exports OAuthCallbackProps
OAuthIdentityProviderConfig
Re-exports OAuthIdentityProviderConfig
OAuthProvider
Re-exports OAuthProvider
OAuthProviderConfig
Re-exports OAuthProviderConfig
OAuthToken
Re-exports OAuthToken
ProviderUserInfo
Re-exports ProviderUserInfo
registerClient
Re-exports registerClient
removeDynamicClient
Re-exports removeDynamicClient
saveDynamicClient
Re-exports saveDynamicClient
supportsDCR
Re-exports supportsDCR
TokenIdentityProviderConfig
Re-exports TokenIdentityProviderConfig
TokenProviderConfig
Re-exports TokenProviderConfig
TokenStatus
Re-exports TokenStatus
updateClientRegistration
Re-exports updateClientRegistration
useConnectedIdentities
Re-exports useConnectedIdentities
useConnectedProviders
Re-exports useConnectedProviders
useIdentity
Re-exports useIdentity
useIdentityError
Re-exports useIdentityError
useIdentityLoading
Re-exports useIdentityLoading
UseIdentityOptions
Re-exports UseIdentityOptions
UseIdentityReturn
Re-exports UseIdentityReturn
useIdentitySelector
Renames and re-exports useIdentity
useIdentityStore
Re-exports useIdentityStore
useIsProviderConnected
Re-exports useIsProviderConnected
usePendingAuthorization
Re-exports usePendingAuthorization