Skip to content

Commit

Permalink
feat(cb2-14394): get token and call recalls
Browse files Browse the repository at this point in the history
  • Loading branch information
naathanbrown committed Nov 14, 2024
1 parent c62a57b commit 230c566
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/util/recalls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const getBearerToken = async (motSecret: MotSecret): Promise<string | und
params.append("client_secret", motSecret.clientSecret);
params.append("scope", motSecret.scopeURL);

console.log(JSON.stringify(motSecret))
console.log(JSON.stringify(params))

const tokenResponse = await fetch(motSecret.accessTokenURL, {
method: 'POST',
Expand All @@ -86,8 +86,12 @@ export const getBearerToken = async (motSecret: MotSecret): Promise<string | und
body: params
});

if(tokenResponse.body){
return JSON.parse(tokenResponse.body.toString()).access_token;
logger.debug('after token fetch')

const body = await tokenResponse.json()

if(body){
return body.access_token;
}
return undefined;
}
Expand Down

0 comments on commit 230c566

Please sign in to comment.