Skip to content

Commit

Permalink
feat: find linkedin error
Browse files Browse the repository at this point in the history
  • Loading branch information
Nevo David committed Sep 26, 2024
1 parent c84d8af commit 69da648
Showing 1 changed file with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import sharp from 'sharp';
import { lookup } from 'mime-types';
import { readOrFetch } from '@gitroom/helpers/utils/read.or.fetch';
import { removeMarkdown } from '@gitroom/helpers/utils/remove.markdown';
import { SocialAbstract } from '@gitroom/nestjs-libraries/integrations/social.abstract';
import {
BadBody,
SocialAbstract,
} from '@gitroom/nestjs-libraries/integrations/social.abstract';

export class LinkedinProvider extends SocialAbstract implements SocialProvider {
identifier = 'linkedin';
Expand All @@ -19,7 +22,11 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {
refreshWait = true;

async refreshToken(refresh_token: string): Promise<AuthTokenDetails> {
const { access_token: accessToken, refresh_token: refreshToken, expires_in } = await (
const {
access_token: accessToken,
refresh_token: refreshToken,
expires_in,
} = await (
await this.fetch('https://www.linkedin.com/oauth/v2/accessToken', {
method: 'POST',
headers: {
Expand Down Expand Up @@ -262,7 +269,13 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {

return finalOutput;
} catch (err: any) {
throw 'eerr';
throw new BadBody(JSON.stringify(err), {
// @ts-ignore
fileName,
personId,
picture,
type,
});
}
}

Expand Down

0 comments on commit 69da648

Please sign in to comment.