feat: remove concurrency from authentication
This commit is contained in:
parent
80c508a8c2
commit
8e06b081e8
|
|
@ -198,7 +198,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
|
|||
refresh?: string;
|
||||
}) {
|
||||
const getAccessToken = await (
|
||||
await this.fetch(
|
||||
await fetch(
|
||||
'https://graph.facebook.com/v20.0/oauth/access_token' +
|
||||
`?client_id=${process.env.FACEBOOK_APP_ID}` +
|
||||
`&redirect_uri=${encodeURIComponent(
|
||||
|
|
@ -212,7 +212,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
|
|||
).json();
|
||||
|
||||
const { access_token } = await (
|
||||
await this.fetch(
|
||||
await fetch(
|
||||
'https://graph.facebook.com/v20.0/oauth/access_token' +
|
||||
'?grant_type=fb_exchange_token' +
|
||||
`&client_id=${process.env.FACEBOOK_APP_ID}` +
|
||||
|
|
@ -222,7 +222,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
|
|||
).json();
|
||||
|
||||
const { data } = await (
|
||||
await this.fetch(
|
||||
await fetch(
|
||||
`https://graph.facebook.com/v20.0/me/permissions?access_token=${access_token}`
|
||||
)
|
||||
).json();
|
||||
|
|
@ -239,7 +239,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
|
|||
data: { url },
|
||||
},
|
||||
} = await (
|
||||
await this.fetch(
|
||||
await fetch(
|
||||
`https://graph.facebook.com/v20.0/me?fields=id,name,picture&access_token=${access_token}`
|
||||
)
|
||||
).json();
|
||||
|
|
@ -257,7 +257,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
|
|||
|
||||
async pages(accessToken: string) {
|
||||
const { data } = await (
|
||||
await this.fetch(
|
||||
await fetch(
|
||||
`https://graph.facebook.com/v20.0/me/accounts?fields=id,username,name,picture.type(large)&access_token=${accessToken}`
|
||||
)
|
||||
).json();
|
||||
|
|
@ -275,7 +275,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
|
|||
data: { url },
|
||||
},
|
||||
} = await (
|
||||
await this.fetch(
|
||||
await fetch(
|
||||
`https://graph.facebook.com/v20.0/${pageId}?fields=username,access_token,name,picture.type(large)&access_token=${accessToken}`
|
||||
)
|
||||
).json();
|
||||
|
|
|
|||
|
|
@ -326,7 +326,7 @@ export class InstagramProvider
|
|||
refresh: string;
|
||||
}) {
|
||||
const getAccessToken = await (
|
||||
await this.fetch(
|
||||
await fetch(
|
||||
'https://graph.facebook.com/v20.0/oauth/access_token' +
|
||||
`?client_id=${process.env.FACEBOOK_APP_ID}` +
|
||||
`&redirect_uri=${encodeURIComponent(
|
||||
|
|
@ -340,7 +340,7 @@ export class InstagramProvider
|
|||
).json();
|
||||
|
||||
const { access_token, expires_in, ...all } = await (
|
||||
await this.fetch(
|
||||
await fetch(
|
||||
'https://graph.facebook.com/v20.0/oauth/access_token' +
|
||||
'?grant_type=fb_exchange_token' +
|
||||
`&client_id=${process.env.FACEBOOK_APP_ID}` +
|
||||
|
|
@ -350,7 +350,7 @@ export class InstagramProvider
|
|||
).json();
|
||||
|
||||
const { data } = await (
|
||||
await this.fetch(
|
||||
await fetch(
|
||||
`https://graph.facebook.com/v20.0/me/permissions?access_token=${access_token}`
|
||||
)
|
||||
).json();
|
||||
|
|
@ -367,7 +367,7 @@ export class InstagramProvider
|
|||
data: { url },
|
||||
},
|
||||
} = await (
|
||||
await this.fetch(
|
||||
await fetch(
|
||||
`https://graph.facebook.com/v20.0/me?fields=id,name,picture&access_token=${access_token}`
|
||||
)
|
||||
).json();
|
||||
|
|
@ -419,13 +419,13 @@ export class InstagramProvider
|
|||
data: { pageId: string; id: string }
|
||||
) {
|
||||
const { access_token, ...all } = await (
|
||||
await this.fetch(
|
||||
await fetch(
|
||||
`https://graph.facebook.com/v20.0/${data.pageId}?fields=access_token,name,picture.type(large)&access_token=${accessToken}`
|
||||
)
|
||||
).json();
|
||||
|
||||
const { id, name, profile_picture_url, username } = await (
|
||||
await this.fetch(
|
||||
await fetch(
|
||||
`https://graph.facebook.com/v20.0/${data.id}?fields=username,name,profile_picture_url&access_token=${accessToken}`
|
||||
)
|
||||
).json();
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {
|
|||
).json();
|
||||
|
||||
const { vanityName } = await (
|
||||
await this.fetch('https://api.linkedin.com/v2/me', {
|
||||
await fetch('https://api.linkedin.com/v2/me', {
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
},
|
||||
|
|
@ -66,7 +66,7 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {
|
|||
sub: id,
|
||||
picture,
|
||||
} = await (
|
||||
await this.fetch('https://api.linkedin.com/v2/userinfo', {
|
||||
await fetch('https://api.linkedin.com/v2/userinfo', {
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
},
|
||||
|
|
@ -122,7 +122,7 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {
|
|||
refresh_token: refreshToken,
|
||||
scope,
|
||||
} = await (
|
||||
await this.fetch('https://www.linkedin.com/oauth/v2/accessToken', {
|
||||
await fetch('https://www.linkedin.com/oauth/v2/accessToken', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
|
|
@ -138,7 +138,7 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {
|
|||
sub: id,
|
||||
picture,
|
||||
} = await (
|
||||
await this.fetch('https://api.linkedin.com/v2/userinfo', {
|
||||
await fetch('https://api.linkedin.com/v2/userinfo', {
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
},
|
||||
|
|
@ -146,7 +146,7 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {
|
|||
).json();
|
||||
|
||||
const { vanityName } = await (
|
||||
await this.fetch('https://api.linkedin.com/v2/me', {
|
||||
await fetch('https://api.linkedin.com/v2/me', {
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
},
|
||||
|
|
@ -174,7 +174,7 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {
|
|||
}
|
||||
|
||||
const { elements } = await (
|
||||
await this.fetch(
|
||||
await fetch(
|
||||
`https://api.linkedin.com/v2/organizations?q=vanityName&vanityName=${getCompanyVanity[1]}`,
|
||||
{
|
||||
method: 'GET',
|
||||
|
|
@ -718,7 +718,7 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {
|
|||
|
||||
override async mention(token: string, data: { query: string }) {
|
||||
const { elements } = await (
|
||||
await this.fetch(
|
||||
await fetch(
|
||||
`https://api.linkedin.com/v2/organizations?q=vanityName&vanityName=${encodeURIComponent(
|
||||
data.query
|
||||
)}&projection=(elements*(id,localizedName,logoV2(original~:playableStreams)))`,
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ export class PinterestProvider
|
|||
|
||||
async refreshToken(refreshToken: string): Promise<AuthTokenDetails> {
|
||||
const { access_token, expires_in } = await (
|
||||
await this.fetch('https://api.pinterest.com/v5/oauth/token', {
|
||||
await fetch('https://api.pinterest.com/v5/oauth/token', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
|
|
@ -68,7 +68,7 @@ export class PinterestProvider
|
|||
).json();
|
||||
|
||||
const { id, profile_image, username } = await (
|
||||
await this.fetch('https://api.pinterest.com/v5/user_account', {
|
||||
await fetch('https://api.pinterest.com/v5/user_account', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: `Bearer ${access_token}`,
|
||||
|
|
@ -108,7 +108,7 @@ export class PinterestProvider
|
|||
refresh: string;
|
||||
}) {
|
||||
const { access_token, refresh_token, expires_in, scope } = await (
|
||||
await this.fetch('https://api.pinterest.com/v5/oauth/token', {
|
||||
await fetch('https://api.pinterest.com/v5/oauth/token', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
|
|
@ -127,7 +127,7 @@ export class PinterestProvider
|
|||
this.checkScopes(this.scopes, scope);
|
||||
|
||||
const { id, profile_image, username } = await (
|
||||
await this.fetch('https://api.pinterest.com/v5/user_account', {
|
||||
await fetch('https://api.pinterest.com/v5/user_account', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: `Bearer ${access_token}`,
|
||||
|
|
@ -148,7 +148,7 @@ export class PinterestProvider
|
|||
|
||||
async boards(accessToken: string) {
|
||||
const { items } = await (
|
||||
await this.fetch('https://api.pinterest.com/v5/boards', {
|
||||
await fetch('https://api.pinterest.com/v5/boards', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ export class TiktokProvider extends SocialAbstract implements SocialProvider {
|
|||
};
|
||||
|
||||
const { access_token, refresh_token, scope } = await (
|
||||
await this.fetch('https://open.tiktokapis.com/v2/oauth/token/', {
|
||||
await fetch('https://open.tiktokapis.com/v2/oauth/token/', {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
|
|
@ -338,7 +338,7 @@ export class TiktokProvider extends SocialAbstract implements SocialProvider {
|
|||
const {
|
||||
data: { max_video_post_duration_sec },
|
||||
} = await (
|
||||
await this.fetch(
|
||||
await fetch(
|
||||
'https://open.tiktokapis.com/v2/post/publish/creator_info/query/',
|
||||
{
|
||||
method: 'POST',
|
||||
|
|
|
|||
Loading…
Reference in New Issue