Skip to content

Commit

Permalink
Update Twitter OAuth (#479)
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinejaussoin authored Feb 24, 2023
1 parent 4324988 commit e995311
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/alpha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'Alpha Build'

on:
push:
branches: [v5000/xx]
branches: [v5000/twitter]

jobs:
frontend:
Expand Down
4 changes: 2 additions & 2 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"copy-templates": "copyfiles -u 0 src/**/*.html dist/"
},
"dependencies": {
"@passport-js/passport-twitter": "1.0.8",
"@sendgrid/mail": "7.7.0",
"@sentry/node": "7.36.0",
"@types/bcryptjs": "2.4.2",
Expand Down Expand Up @@ -81,12 +80,13 @@
"passport-microsoft": "1.0.0",
"passport-okta-oauth20": "1.1.0",
"passport-slack-oauth2": "1.1.1",
"passport-twitter": "^1.0.4",
"pg": "8.9.0",
"prettier": "2.8.3",
"rate-limiter-flexible": "2.4.1",
"redis": "3.1.2",
"rimraf": "4.1.2",
"request": "^2.88.2",
"rimraf": "4.1.2",
"scripty": "^2.1.1",
"shortid": "2.2.16",
"socket.io": "4.5.4",
Expand Down
2 changes: 1 addition & 1 deletion backend/src/auth/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IStrategyOption } from '@passport-js/passport-twitter';
import { IStrategyOption } from 'passport-twitter';
import { StrategyOptions as GoogleStrategyOptions } from 'passport-google-oauth20';
import { StrategyOptions as GitHubStrategy } from 'passport-github2';
import { MicrosoftStrategyOptions } from 'passport-microsoft';
Expand Down
2 changes: 1 addition & 1 deletion backend/src/auth/passport.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import passport from 'passport';
import { Strategy as LocalStrategy, IVerifyOptions } from 'passport-local';
import { Strategy as TwitterStrategy } from '@passport-js/passport-twitter';
import { Strategy as TwitterStrategy } from 'passport-twitter';
import { Strategy as GoogleStrategy } from 'passport-google-oauth20';
import { Strategy as GithubStrategy } from 'passport-github2';
import { Strategy as SlackStrategy } from 'passport-slack-oauth2';
Expand Down
57 changes: 0 additions & 57 deletions backend/src/typings/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,60 +17,3 @@ declare namespace Express {

declare module 'freemail';
declare module 'passport-slack-oauth2';
declare module '@passport-js/passport-twitter' {
interface IStrategyOptionBase {
consumerKey: string;
consumerSecret: string;
callbackURL: string;

includeEmail?: boolean | undefined;
includeStatus?: boolean | undefined;
includeEntities?: boolean | undefined;

requestTokenURL?: string | undefined;
accessTokenURL?: string | undefined;
userAuthorizationURL?: string | undefined;
sessionKey?: string | undefined;

forceLogin?: boolean | undefined;
screenName?: string | undefined;

userProfileURL?: string | undefined;
skipExtendedUserProfile?: boolean | undefined;
}

interface IStrategyOption extends IStrategyOptionBase {
passReqToCallback?: false | undefined;
}

interface IStrategyOptionWithRequest extends IStrategyOptionBase {
passReqToCallback: true;
}

declare class Strategy extends passport.Strategy {
constructor(
options: IStrategyOption,
verify: (
accessToken: string,
refreshToken: string,
profile: Profile,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
done: (error: any, user?: any) => void
) => void
);
constructor(
options: IStrategyOptionWithRequest,
verify: (
req: express.Request,
accessToken: string,
refreshToken: string,
profile: Profile,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
done: (error: any, user?: any) => void
) => void
);

name: string;
authenticate(req: express.Request, options?: unknown): void;
}
}
64 changes: 20 additions & 44 deletions backend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -616,21 +616,6 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"

"@passport-js/[email protected]":
version "1.0.8"
resolved "https://registry.yarnpkg.com/@passport-js/passport-twitter/-/passport-twitter-1.0.8.tgz#371107bb1085e683aa7855421b66c0528d2bf32b"
integrity sha512-N2LrsXkMJ26HmYpjjdRBMuwfa9OoHTMvxMZCNnXdM3E2P5V5j+Hs8aZ0n+v20hlwYDrI4gacVfX3YAufUte4Dw==
dependencies:
"@passport-js/xtraverse" "^0.1.3"
passport-oauth1 "1.x.x"

"@passport-js/xtraverse@^0.1.3":
version "0.1.3"
resolved "https://registry.yarnpkg.com/@passport-js/xtraverse/-/xtraverse-0.1.3.tgz#4378cadb3691256f726df944a877a8a6047a24fb"
integrity sha512-V1tgQcqjVhBVdDvtNwkbz+NjxqPMAD6PhBhT0kEUDV/Lu1HPixRKsp8Wm3NTIMFTBmDlbhDyDAawhdlB5FKZIw==
dependencies:
"@xmldom/xmldom" "^0.8.6"

"@sendgrid/client@^7.7.0":
version "7.7.0"
resolved "https://registry.yarnpkg.com/@sendgrid/client/-/client-7.7.0.tgz#f8f67abd604205a0d0b1af091b61517ef465fdbf"
Expand Down Expand Up @@ -1210,11 +1195,6 @@
"@typescript-eslint/types" "5.50.0"
eslint-visitor-keys "^3.3.0"

"@xmldom/xmldom@^0.8.6":
version "0.8.6"
resolved "https://registry.yarnpkg.com/@xmldom/xmldom/-/xmldom-0.8.6.tgz#8a1524eb5bd5e965c1e3735476f0262469f71440"
integrity sha512-uRjjusqpoqfmRkTaNuLJ2VohVr67Q5YwDATW3VU7PfzTj6IRaihGrYI7zckGZjxQPBIp63nfvJbM+Yu5ICh0Bg==

abbrev@1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
Expand Down Expand Up @@ -1587,11 +1567,6 @@ caseless@~0.12.0:
resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc"
integrity sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==

caseless@~0.12.0:
version "0.12.0"
resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc"
integrity sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==

chalk-template@^0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/chalk-template/-/chalk-template-0.5.0.tgz#fc4051675895e931eacf7f9a5f38763824c2d543"
Expand Down Expand Up @@ -2390,20 +2365,6 @@ form-data@^2.5.0:
combined-stream "^1.0.6"
mime-types "^2.1.12"

forever-agent@~0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91"
integrity sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==

form-data@^2.5.0:
version "2.5.1"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.5.1.tgz#f2cbec57b5e59e23716e128fe44d4e5dd23895f4"
integrity sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==
dependencies:
asynckit "^0.4.0"
combined-stream "^1.0.6"
mime-types "^2.1.12"

form-data@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f"
Expand Down Expand Up @@ -3783,6 +3744,14 @@ [email protected]:
resolved "https://registry.yarnpkg.com/passport-strategy/-/passport-strategy-1.0.0.tgz#b5539aa8fc225a3d1ad179476ddf236b440f52e4"
integrity sha512-CB97UUvDKJde2V0KDWWB3lyf6PC3FaZP7YxZ2G8OAtn9p4HI9j9JLP9qjOGZFvyl8uwNT8qM+hGnz/n16NI7oA==

passport-twitter@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/passport-twitter/-/passport-twitter-1.0.4.tgz#01a799e1f760bf2de49f2ba5fba32282f18932d7"
integrity sha512-qvdauqCqCJJci82mJ9hZZQ6nAv7aSHV31svL8+9H7mRlDdXCdfU6AARQrmmJu3DRmv9fvIebM7zzxR7mVufN3A==
dependencies:
passport-oauth1 "1.x.x"
xtraverse "0.1.x"

[email protected]:
version "0.5.0"
resolved "https://registry.yarnpkg.com/passport/-/passport-0.5.0.tgz#7914aaa55844f9dce8c3aa28f7d6b73647ee0169"
Expand Down Expand Up @@ -3998,11 +3967,6 @@ punycode@^2.1.0, punycode@^2.1.1:
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f"
integrity sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==

punycode@^2.1.1:
version "2.3.0"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f"
integrity sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==

[email protected], qs@^6.11.0:
version "6.11.0"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a"
Expand Down Expand Up @@ -4932,11 +4896,23 @@ xmlbuilder@~11.0.0:
resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-11.0.1.tgz#be9bae1c8a046e76b31127726347d0ad7002beb3"
integrity sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==

[email protected]:
version "0.1.31"
resolved "https://registry.yarnpkg.com/xmldom/-/xmldom-0.1.31.tgz#b76c9a1bd9f0a9737e5a72dc37231cf38375e2ff"
integrity sha512-yS2uJflVQs6n+CyjHoaBmVSqIDevTAWrzMmjG1Gc7h1qQ7uVozNhEPJAwZXWyGQ/Gafo3fCwrcaokezLPupVyQ==

xtend@^4.0.0, xtend@~4.0.1:
version "4.0.2"
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"
integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==

[email protected]:
version "0.1.0"
resolved "https://registry.yarnpkg.com/xtraverse/-/xtraverse-0.1.0.tgz#b741bad018ef78d8a9d2e83ade007b3f7959c732"
integrity sha512-MANQdlG2hl1nQobxz1Rv8hsS1RuBS0C1N6qTOupv+9vmfrReePdxhmB2ecYjvsp4stJ80HD7erjkoF1Hd/FK9A==
dependencies:
xmldom "0.1.x"

y18n@^5.0.5:
version "5.0.8"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55"
Expand Down

0 comments on commit e995311

Please sign in to comment.