Skip to content
Agentmart
Submit a tool

expo-auth

Patrones de autenticación: useAuth hook, token management, Google Sign-In, requestWithAuth.

Skill by myquota

IndexedMIT★ 2
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/cabrerojas-expo-auth

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Patrones de autenticación: useAuth hook, token management, Google Sign-In, requestWithAuth. Trigger: Cuando se trabaja con autenticación, tokens, o Google Sign-In.

Use cases: security

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/expo-auth

What's inside

Skill name
expo-auth
Description
Patrones de autenticación: useAuth hook, token management, Google Sign-In, requestWithAuth. Trigger: Cuando se trabaja con autenticación, tokens, o Google Sign-In.
License
MIT
Metadata
author: myquota · version: 1.0
Instructions
210 lines in SKILL.md · view on GitHub

Before installing

  • Instructions call the network

Files (1)

  • SKILL.md

SKILL.md (first lines)

## Propósito

Entender y trabajar con el sistema de autenticación de MyQuota App.

---

## Flujo de Autenticación

```
1. Usuario abre app
   └── src/app/index.tsx revisa SecureStore

2. Si hay token → /dashboard
   Si no hay token → /login

3. En login:
   └── Google Sign-In → POST /login/google → { accessToken, refreshToken }

4. Tokens se guardan:
   └── SecureStore (primario)
   └── AsyncStorage (legacy/fallback)

5. Requests autenticadas:
   └── requestWithAuth adjunta Bearer token
   └── Si 401 → refresh automático
   └── Si refresh falla → limpiar tokens → /login
```

---

## Archivo Clave

`src/features/auth/hooks/useAuth.ts` exporta:

- `requestWithAuth` — HTTP client autenticado
- `signInWithGoogle` — Flujo de Google Sign-In
- `signOut` — Logout
- `getAccessToken` — Obtener token actual

---

## requestWithAuth

```typescript
import { requestWithAuth } from "@/features/auth/hooks/useAuth";

// Uso básico
const response = await requestWithAuth(`${API_BASE_URL}/items`);

// Con opciones
const response = await requestWithAuth(`${API_BASE_URL}/items`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify(data),
});
```

**Comportamiento automático:**
1. Adjunta `Authorization: Bearer <accessToken>`
2. Si 401 con `code: "token_expired"` → intenta refresh
3. Si refresh OK → reintenta request original
4. Si refresh falla → limpia tokens → redirige a login

---

## Almacenamiento de Tokens

```typescript
import * as SecureStore from "expo-secure-store";

// Guardar
await SecureStore.setItemAsync("accessToken", token);
await SecureStore.setItemAsync("refreshToken", refreshToken);

// Leer
const token = await SecureStore.getItemAsync("accessToken");

// Eliminar
await SecureStore.deleteItemAsync("accessToken");
```

**Nota**: Actualmente también se usa AsyncStorage como fallback (deuda técnica).

---

## Google Sign-In

Desde el hook `useAuth`:

```typescript
import { useAuth } from "@/features/auth/hooks/useAuth";

export default function LoginScreen() {
  const { signInWithGoogle, loading, error } = useAuth();

  const handleLogin = async () => {
    try {
      await signInWithGoogle();
      // Si éxito, redirige automáticamente a /dashboard
    } catch (err) {
      // Error ya manejado por el hook
    }
  };

  return (
    <Button title="Iniciar con Google" onPress={handleLogin} disabled={loading} />
  );
}
```

---

## Logout

```typescript
import { useAuth } from "@/features/auth/hooks/useAuth";

const { signOut } = useAuth();

From cabrerojas/myquota-app, MIT.

More from cabrerojas/myquota-app

Signals

Stars
2
Forks
0
Open issues
0
Last commit (this folder)
Aug 15, 2026 (2 months ago)

From GitHub (fetched Oct 24, 2026).

Details

Version
1.0
License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from myquota

Cite this page

expo-auth skill. Agent Mart. https://agentmart.dev/skills/cabrerojas-expo-auth (last updated 2026-10-24)