@ai-oauth-sdk/vue
| Install | |
|---|---|
npm install @ai-oauth-sdk/vue |
|
| Latest Version: | 1.3.0 |
| Vue: | 3 |
| License: | MIT |
| Last Updated: | Sep 26, 2026 |
| Links: | GitHub · npm |
@ai-oauth-sdk/vue
Vue 3 composable for ai-oauth-sdk.
npm i @ai-oauth-sdk/vue @ai-oauth-sdk/browser
<script setup>
import { useAuth } from '@ai-oauth-sdk/vue'
import { popupReceiver } from '@ai-oauth-sdk/browser'
const { login, logout, tokens, isLoading, error } = useAuth({
provider: 'openai',
clientId: import.meta.env.VITE_CLIENT_ID,
receiver: popupReceiver(),
})
</script>
<template>
<button v-if="tokens" @click="logout()">Sign out ({{ tokens.email }})</button>
<button v-else :disabled="isLoading" @click="login()">
{{ error ? `Retry: ${error.message}` : 'Sign in with ChatGPT' }}
</button>
</template>
Notes
Returns readonly refs, so template state cannot be reassigned by accident. tokens and error are
shallowRefs: a TokenSet is replaced wholesale and never mutated in place, so deep reactivity
would only cost proxy overhead.
Cleanup runs through onScopeDispose, so this works unchanged inside setup(), a detached
effectScope(), or a Pinia store.
Cancelling a login by closing the popup resolves to undefined and leaves error untouched. That
is a user action, not a failure.
Requires Vue 3.3+. vue is a peer dependency.
License
MIT
An independent, unofficial project. Not affiliated with or endorsed by OpenAI, Anthropic, Google, GitHub, Microsoft, xAI, Alibaba or OpenRouter; all trademarks belong to their owners. No provider officially supports these OAuth flows, and any of them may change without notice. Please read the disclaimer.
Related Packages
Aidex Admin Vue adapter — a useAdmin(controller) composable wrapping @aidex/admi...
Agent Skills for the Central Design System (CDS 4): component API reference, exa...
Vue 3 composables to give AI assistants real-time context about what users see a...
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 1.3.0 | >=3.3 | MIT | |
| 1.2.0 | >=3.3 | MIT | |
| 1.1.3 | >=3.3 | MIT | |
| 1.1.2 | >=3.3 | MIT | |
| 1.1.1 | >=3.3 | MIT | |
| 1.1.0 | >=3.3 | MIT | |
| 1.0.2 | >=3.3 | MIT | |
| 1.0.1 | >=3.3 | MIT | |
| 1.0.0 | >=3.3 | MIT | |
| 0.3.0 | >=3.3 | MIT | |
| 0.2.1 | >=3.3 | MIT | |
| 0.2.0 | >=3.3 | MIT | |
| 0.1.1 | >=3.3 | MIT | |
| 0.1.0 | >=3.3 | MIT |