Skip to content

Commit

Permalink
fix(authentication): type bug (#1134)
Browse files Browse the repository at this point in the history
* fix(authentication): type bug

* fix(authentication): handle failed attempt of internal user tokens creation

---------

Co-authored-by: Rena Tsagka <[email protected]>
  • Loading branch information
ChrisPdgn and Renc17 authored Sep 6, 2024
1 parent a979dc3 commit 8604b92
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions modules/authentication/src/Authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,23 +234,22 @@ export default class Authentication extends ManagedModule<Config> {
}
const config = ConfigController.getInstance().config;

const tokens = await TokenProvider.getInstance()
.provideUserTokensInternal({
try {
const tokens = await TokenProvider.getInstance().provideUserTokensInternal({
user,
clientId,
config,
})
.catch(() => {
return callback({
code: status.INTERNAL,
message: 'Failed to login',
});
});

return callback(null, {
accessToken: tokens.accessToken,
refreshToken: tokens.refreshToken ?? undefined,
});
return callback(null, {
accessToken: tokens.accessToken,
refreshToken: tokens.refreshToken ?? undefined,
});
} catch (e) {
return callback({
code: status.INTERNAL,
message: 'Failed to login',
});
}
}

async userCreate(
Expand Down

0 comments on commit 8604b92

Please sign in to comment.