mirror of
https://github.com/modrinth/code.git
synced 2026-08-31 03:55:59 +00:00
feat: initial implementation of new sign-in oauth
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user