mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-23 05:21:15 +00:00
6f3c051c7c
Formats the files the client formatting gate listed, and NATIVE-E2E-005 sends its twenty exchange attempts one after another: all at once they reset the test server's connections.
13 lines
694 B
TypeScript
13 lines
694 B
TypeScript
import type { NativeExchangeRequest, NativeHandoffResponse } from '@trek/shared';
|
|
import { apiClient } from './client';
|
|
|
|
/** The two halves of the sign-in hand-off between system browser and app. */
|
|
export const nativeAuthApi = {
|
|
/** Browser side: trade a signed-in session for a one-time code bound to `challenge`. */
|
|
handoff: (challenge: string): Promise<NativeHandoffResponse> =>
|
|
apiClient.post('/auth/native/handoff', { challenge }).then((r) => r.data),
|
|
/** App side: redeem the code with the verifier; the response sets the session cookie. */
|
|
exchange: (body: NativeExchangeRequest): Promise<void> =>
|
|
apiClient.post('/auth/native/exchange', body).then(() => undefined),
|
|
};
|