---
title: "Refresh Oauth"
method: POST
path: "/api/v1/me/refresh-oauth"
tags: ["me-oauth"]
---

# Refresh Oauth

`POST /api/v1/me/refresh-oauth`

## Request

- Base URL: `https://memory.kagura-ai.com` (the document declares no server; this is the origin it was published from)
- URL: `https://memory.kagura-ai.com/api/v1/me/refresh-oauth`
- Auth: none declared

Initiate a manual IdP refresh for the current user.

Returns:
    JSON with ``authorization_url`` (frontend redirects to it) and
    the CSRF ``state`` token (for symmetry with ``/auth/{provider}/login``).

Raises:
    HTTPException(400): user is password-auth, or has no usable
        ``auth_provider`` (a legacy null from before #361, or the last
        provider was unlinked). The pointer is set again only by a
        sign-in through the identity the account was created with, once
        its link is established (#1875, ``auth.roles``) — never by
        linking a provider, nor by signing in through one attached
        later, however old its link.
    HTTPException(429): more than 1 request in the current minute
        window. ``Retry-After`` header is set on the response.
    HTTPException(500): OAuth managers not initialised, or required
        environment variables missing.

## Headers

- `authorization` string, nullable

## Request body

- RefreshOAuthRequest: Optional ``return_to`` lets the frontend control the post-callback landing page. Must be a same-origin relative path starting with ``/``; absolute or protocol-relative URLs are rejected at the endpoint to block open-redirect after successful re-auth. Defaults to ``/profile?refreshed=1`` so a vanilla button click works without extra wiring.
  - `return_to` string, nullable

## Response `200`

Successful Response

- RefreshOAuthResponse: Frontend redirects ``window.location`` to ``authorization_url``.
  - `authorization_url` string, required
  - `state` string, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud.md) · [All operations](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud/llms.txt) · [OpenAPI document](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud/revisions/09f17f5ada29?raw)
