Skip to content

Commit

Permalink
add optional name for signUpWithEmail
Browse files Browse the repository at this point in the history
  • Loading branch information
jamalavedra committed Mar 11, 2024
1 parent 02d51ea commit 90b8078
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfort/openfort-js",
"version": "0.5.0",
"version": "0.5.1",
"description": "",
"author": "Openfort",
"repository": {
Expand Down
10 changes: 5 additions & 5 deletions src/generated/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
12 changes: 6 additions & 6 deletions src/openfort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,29 +89,29 @@ export default class Openfort {
}

public async loginWithEmailPassword(email: string, password: string): Promise<string> {
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<string> {
public async authorizeWithOAuthToken(provider: OAuthProvider, token: string): Promise<string> {
const result = await this._openfortAuth.authorizeWithOAuthToken(provider, token);
this.storeCredentials(result);
return result.accessToken;
}

public async signUpWithEmailPassword(email: string, password: string): Promise<string> {
const result = await this._openfortAuth.signUp(email, password);
public async signUpWithEmailPassword(email: string, password: string, name?: string): Promise<string> {
const result = await this._openfortAuth.signupEmailPassword(email, password, name);
this.storeCredentials(result);
return result.accessToken;
}

public async initOAuth(provider: OAuthProvider): Promise<InitAuthResponse> {
return await this._openfortAuth.getAuthenticationURL(provider);
return await this._openfortAuth.initOAuth(provider);
}

public async authenticateOAuth(provider: OAuthProvider, key: string): Promise<string> {
const result = await this._openfortAuth.GetTokenAfterSocialLogin(provider, key);
const result = await this._openfortAuth.authenticateOAuth(provider, key);
this.storeCredentials(result);
return result.accessToken;
}
Expand Down
10 changes: 5 additions & 5 deletions src/openfortAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ export class OpenfortAuth {
};
}

public async getAuthenticationURL(provider: OAuthProvider): Promise<InitAuthResponse> {
public async initOAuth(provider: OAuthProvider): Promise<InitAuthResponse> {
const result = await this._oauthApi.initOAuth({token: "", provider: provider});
return {
url: result.data.url,
key: result.data.key,
};
}

public async GetTokenAfterSocialLogin(provider: OAuthProvider, key: string): Promise<Auth> {
public async authenticateOAuth(provider: OAuthProvider, key: string): Promise<Auth> {
const result = await this._oauthApi.authenticateOAuth({provider: provider, token: key});
return {
player: result.data.player.id,
Expand All @@ -58,7 +58,7 @@ export class OpenfortAuth {
};
}

public async authorizeWithEmailPassword(email: string, password: string): Promise<Auth> {
public async loginEmailPassword(email: string, password: string): Promise<Auth> {
const result = await this._oauthApi.loginEmailPassword({email, password});
return {
player: result.data.player.id,
Expand All @@ -67,8 +67,8 @@ export class OpenfortAuth {
};
}

public async signUp(email: string, password: string): Promise<Auth> {
const result = await this._oauthApi.signupEmailPassword({name: "", email, password});
public async signupEmailPassword(email: string, password: string, name?: string): Promise<Auth> {
const result = await this._oauthApi.signupEmailPassword({name: name, email, password});
return {
player: result.data.player.id,
accessToken: result.data.token,
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const VERSION = "0.5.0";
export const VERSION = "0.5.1";
export const PACKAGE = "@openfort/openfort-js";

0 comments on commit 90b8078

Please sign in to comment.