Skip to content

Commit dfff2e6

Browse files
fix: correctly set authorization url for OAuth1 (#2884)
1 parent 5149a5d commit dfff2e6

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/server/lib/oauth/authorization-url.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,16 @@ export default async function getAuthorizationUrl(req, res) {
1717
/** @type {import("src/providers").OAuthConfig} */
1818
const provider = req.options.provider
1919

20-
let params = {}
21-
22-
if (typeof provider.authorization === "string") {
23-
const parsedUrl = new URL(provider.authorization)
24-
const parsedParams = Object.fromEntries(parsedUrl.searchParams.entries())
25-
params = { ...params, ...parsedParams }
26-
} else {
27-
params = { ...params, ...provider.authorization?.params }
20+
const params = {
21+
...provider.authorization.params,
22+
...req.query,
2823
}
2924

30-
params = { ...params, ...req.query }
31-
3225
// Handle OAuth v1.x
3326
if (provider.version?.startsWith("1.")) {
3427
const client = oAuth1Client(req.options)
3528
const tokens = await client.getOAuthRequestToken(params)
36-
const url = `${provider.authorization}?${new URLSearchParams({
29+
const url = `${provider.authorization.url}?${new URLSearchParams({
3730
oauth_token: tokens.oauth_token,
3831
oauth_token_secret: tokens.oauth_token_secret,
3932
...tokens.params,

0 commit comments

Comments
 (0)