@ai-oauth-sdk/vue

Vue 3 composable for ai-oauth-sdk. Sign in with ChatGPT, Claude, Gemini or Grok.
2,648 3
Install
npm install @ai-oauth-sdk/vue
Latest Version:1.3.0
Vue:3
License:MIT
Last Updated:Sep 26, 2026
Links: GitHub  ·  npm
Maintainer: themonk-bot

@ai-oauth-sdk/vue

Vue 3 composable for ai-oauth-sdk.

Documentation

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

Aidex Admin Vue adapter — a useAdmin(controller) composable wrapping @aidex/admi...

1,186 3
gk-search

A Vue component for gk-chat into your application.

1,042
@syzlm/fe-ai

面向前端项目的 AI 编码规范初始化工具

3,061
@central-design-system/skills

Agent Skills for the Central Design System (CDS 4): component API reference, exa...

769
@askable-ui/vue

Vue 3 composables to give AI assistants real-time context about what users see a...

6,143 12

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