feat: initial implementation of new sign-in oauth

This commit is contained in:
tdgao
2026-04-13 15:05:30 -06:00
parent c0fd7bebbd
commit c1696e0d9a
6 changed files with 205 additions and 29 deletions
@@ -57,6 +57,23 @@ export class LabrinthAuthV2Module extends AbstractModule {
})
}
/**
* Create a new account from an OAuth callback flow state
*
* @param data - OAuth account creation data
* @returns Promise resolving to a session response
*/
public async createOAuthAccount(
data: Labrinth.Auth.v2.CreateOAuthAccountRequest,
): Promise<Labrinth.Auth.v2.CreateOAuthAccountResponse> {
return this.client.request<Labrinth.Auth.v2.CreateOAuthAccountResponse>(`/auth/create/oauth`, {
api: 'labrinth',
version: 2,
method: 'POST',
body: data,
})
}
/**
* Begin a password reset flow by sending a recovery email
*
@@ -278,6 +278,17 @@ export namespace Labrinth {
session: string
}
export type CreateOAuthAccountRequest = {
username: string
state: string
challenge: string
sign_up_newsletter: boolean
}
export type CreateOAuthAccountResponse = {
session: string
}
export type ResetPasswordRequest = {
username: string
challenge: string