← Public packages
@kentcdodds/x
X API v2 helpers for tweets, search, legacy DMs, and encrypted X Chat via a Fly XDK sidecar.
src/refresh-oauth-token.ts
21 lines · 995 B · TypeScriptimport { refreshOauthToken } from './client.ts'
import type { XRefreshTokenParams } from './client.ts'
/**
* Refresh and persist the X OAuth access and refresh token secrets.
*
* Rotation runs through the host `integrationTokenRefresh` helper, which
* persists the rotated refresh token before the access token. X invalidates
* the old refresh token as soon as it issues a new one, so that ordering is
* what keeps a failed write recoverable instead of requiring a reconnect. Host
* refresh returns metadata only — the new access token stays on the connection.
*
* @returns Refresh status for the resolved integration and account.
* @example
* import refreshOauthToken from 'kody:@kentcdodds/x/refresh-oauth-token'
* const result = await refreshOauthToken()
* // => { ok: true, accessTokenUpdated: true, integration: 'x', account: null }
*/
export default async function refreshOauthTokenEntrypoint(params: XRefreshTokenParams = {}) {
return await refreshOauthToken(params)
}