Skip to content
This repository has been archived by the owner on Jun 13, 2022. It is now read-only.

Commit

Permalink
feat: change signature of getAccessTokenFromClientCredentialFlow
Browse files Browse the repository at this point in the history
* Matches the other signatures now
* Should return a Promise with an optional error in some uniform way
  in the future
  • Loading branch information
jdjkelly committed Dec 16, 2021
1 parent be05ff7 commit e818aaf
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/smart-auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ const oauthPlugin: FastifyPluginCallback<SmartAuthProvider<AuthCodeConfig>> = fu
export const getAccessTokenFromClientCredentialFlow = async (
smartAuthProvider: SmartAuthProvider<ClientCredentialsConfig>,
scope?: string[]
): Promise<AccessToken | undefined> => {
): Promise<AccessToken> => {
const clientCredentialsOptions = {
client: smartAuthProvider.client,
auth: {
Expand All @@ -236,11 +236,7 @@ export const getAccessTokenFromClientCredentialFlow = async (
...smartAuthProvider.auth.tokenParams
}

try {
return await client.getToken(params);
} catch (error: any) {
console.log('Access Token error', error.message);
}
return await client.getToken(params);
};

export default fastifyPlugin(oauthPlugin, {
Expand Down

0 comments on commit e818aaf

Please sign in to comment.