From 90b807810600d0b36fb96aa85517db5db44669dc Mon Sep 17 00:00:00 2001 From: Jaume Alavedra Date: Mon, 11 Mar 2024 16:06:21 +0100 Subject: [PATCH] add optional name for signUpWithEmail --- package.json | 2 +- src/generated/api.ts | 10 +++++----- src/openfort.ts | 12 ++++++------ src/openfortAuth.ts | 10 +++++----- src/version.ts | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 404bec1..551dfe3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@openfort/openfort-js", - "version": "0.5.0", + "version": "0.5.1", "description": "", "author": "Openfort", "repository": { diff --git a/src/generated/api.ts b/src/generated/api.ts index 449a73f..ddc0078 100644 --- a/src/generated/api.ts +++ b/src/generated/api.ts @@ -7046,25 +7046,25 @@ export interface SignatureRequest { */ export interface SignupRequest { /** - * The email address of the user. + * The email address of the player. * @type {string} * @memberof SignupRequest */ 'email': string; /** - * The password of the user. + * The password of the player. * @type {string} * @memberof SignupRequest */ 'password': string; /** - * The name of the user. + * The name of the player. * @type {string} * @memberof SignupRequest */ - 'name': string; + 'name'?: string; /** - * The description of the user. + * The description of the player. * @type {string} * @memberof SignupRequest */ diff --git a/src/openfort.ts b/src/openfort.ts index 8145124..853c0e7 100644 --- a/src/openfort.ts +++ b/src/openfort.ts @@ -89,29 +89,29 @@ export default class Openfort { } public async loginWithEmailPassword(email: string, password: string): Promise { - const result = await this._openfortAuth.authorizeWithEmailPassword(email, password); + const result = await this._openfortAuth.loginEmailPassword(email, password); this.storeCredentials(result); return result.accessToken; } - public async loginWithOAuthToken(provider: OAuthProvider, token: string): Promise { + public async authorizeWithOAuthToken(provider: OAuthProvider, token: string): Promise { const result = await this._openfortAuth.authorizeWithOAuthToken(provider, token); this.storeCredentials(result); return result.accessToken; } - public async signUpWithEmailPassword(email: string, password: string): Promise { - const result = await this._openfortAuth.signUp(email, password); + public async signUpWithEmailPassword(email: string, password: string, name?: string): Promise { + const result = await this._openfortAuth.signupEmailPassword(email, password, name); this.storeCredentials(result); return result.accessToken; } public async initOAuth(provider: OAuthProvider): Promise { - return await this._openfortAuth.getAuthenticationURL(provider); + return await this._openfortAuth.initOAuth(provider); } public async authenticateOAuth(provider: OAuthProvider, key: string): Promise { - const result = await this._openfortAuth.GetTokenAfterSocialLogin(provider, key); + const result = await this._openfortAuth.authenticateOAuth(provider, key); this.storeCredentials(result); return result.accessToken; } diff --git a/src/openfortAuth.ts b/src/openfortAuth.ts index c966551..5301bf1 100644 --- a/src/openfortAuth.ts +++ b/src/openfortAuth.ts @@ -41,7 +41,7 @@ export class OpenfortAuth { }; } - public async getAuthenticationURL(provider: OAuthProvider): Promise { + public async initOAuth(provider: OAuthProvider): Promise { const result = await this._oauthApi.initOAuth({token: "", provider: provider}); return { url: result.data.url, @@ -49,7 +49,7 @@ export class OpenfortAuth { }; } - public async GetTokenAfterSocialLogin(provider: OAuthProvider, key: string): Promise { + public async authenticateOAuth(provider: OAuthProvider, key: string): Promise { const result = await this._oauthApi.authenticateOAuth({provider: provider, token: key}); return { player: result.data.player.id, @@ -58,7 +58,7 @@ export class OpenfortAuth { }; } - public async authorizeWithEmailPassword(email: string, password: string): Promise { + public async loginEmailPassword(email: string, password: string): Promise { const result = await this._oauthApi.loginEmailPassword({email, password}); return { player: result.data.player.id, @@ -67,8 +67,8 @@ export class OpenfortAuth { }; } - public async signUp(email: string, password: string): Promise { - const result = await this._oauthApi.signupEmailPassword({name: "", email, password}); + public async signupEmailPassword(email: string, password: string, name?: string): Promise { + const result = await this._oauthApi.signupEmailPassword({name: name, email, password}); return { player: result.data.player.id, accessToken: result.data.token, diff --git a/src/version.ts b/src/version.ts index 24ef830..cbdf5d5 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1,2 +1,2 @@ -export const VERSION = "0.5.0"; +export const VERSION = "0.5.1"; export const PACKAGE = "@openfort/openfort-js";