Skip to content

Commit

Permalink
Merge pull request #11 from shmbajaj/main
Browse files Browse the repository at this point in the history
Fix: missing jwt for edit profile url
  • Loading branch information
sahilsuman933 authored Dec 29, 2023
2 parents 7612f26 + ba124d1 commit 3cd5799
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "trustauthx",
"version": "1.0.41",
"version": "1.0.42",
"description": "",
"type": "module",
"main": "./dist/cjs/index.js",
Expand Down
18 changes: 9 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ export class AuthLiteClient {
else throw new Error('Must provide org_id');
}

generateEditUserUrl(accessToken: string, url: string): string {
async generateEditUserUrl(accessToken: string, url: string): Promise<string> {
if (!this.signedKey) {
throw Error('JWT Token Not Available');
this.signedKey = await this.getEncodedJWT();
}
const params = new URLSearchParams({
AccessToken: accessToken,
Expand Down Expand Up @@ -80,7 +80,7 @@ export class AuthLiteClient {
throw new Error(
`Request failed with status code: ${
response.status
}\n${await response.text()}`,
}\n${await response.text()}`
);
}
} catch (error) {
Expand Down Expand Up @@ -120,7 +120,7 @@ export class AuthLiteClient {
throw new Error(
`Request failed with status code: ${
response.status
}\n${await response.text()}`,
}\n${await response.text()}`
);
}
} catch (error) {
Expand Down Expand Up @@ -152,7 +152,7 @@ export class AuthLiteClient {
throw new Error(
`Request failed with status code: ${
response.status
}\n${await response.text()}`,
}\n${await response.text()}`
);
}
} catch (error: any) {
Expand Down Expand Up @@ -187,7 +187,7 @@ export class AuthLiteClient {
async revokeToken(
accessToken: string,
refreshToken: string | null = null,
revokeAllTokens: boolean = false,
revokeAllTokens: boolean = false
): Promise<boolean> {
const url = 'https://api.trustauthx.com/api/user/me/token/';
const headers = { accept: 'application/json' };
Expand Down Expand Up @@ -258,7 +258,7 @@ export class AuthLiteClient {
throw new Error(
`Request failed with status code: ${
response.status
}\n${await response.text()}`,
}\n${await response.text()}`
);
}
} catch (error) {
Expand All @@ -268,7 +268,7 @@ export class AuthLiteClient {

async validateTokenSet(
access_token: string,
refresh_token: string,
refresh_token: string
): Promise<TokenCheck> {
try {
const d: TokenCheck = {
Expand All @@ -280,7 +280,7 @@ export class AuthLiteClient {
if (!is_valid) {
if (refresh_token) {
const new_tokens = await this.getAccessTokenFromRefreshToken(
refresh_token,
refresh_token
);
d.state = false;
d.access = new_tokens['access_token'];
Expand Down

0 comments on commit 3cd5799

Please sign in to comment.