mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-09-10 03:41:52 +02:00
fix(auth-oauth1): sign with the token secret when no access token is set (#611)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
0aae516f3a
commit
50cccf1d25
@@ -161,7 +161,7 @@ export const plugin: PluginDefinition = {
|
||||
if (values.timestamp) requestData.data.oauth_timestamp = String(values.timestamp);
|
||||
if (values.verifier) requestData.data.oauth_verifier = String(values.verifier);
|
||||
|
||||
let token: OAuth.Token | { key: string } | undefined;
|
||||
let token: OAuth.Token | { key: string } | { secret: string } | undefined;
|
||||
|
||||
if (pkSigs.includes(signatureMethod)) {
|
||||
token = {
|
||||
@@ -172,6 +172,10 @@ export const plugin: PluginDefinition = {
|
||||
token = { key: String(values.tokenKey), secret: String(values.tokenSecret) };
|
||||
} else if (values.tokenKey) {
|
||||
token = { key: String(values.tokenKey) };
|
||||
} else if (values.tokenSecret) {
|
||||
// The secret still joins the signing key without an access token;
|
||||
// leaving `key` out keeps oauth_token out of the header entirely
|
||||
token = { secret: String(values.tokenSecret) };
|
||||
}
|
||||
|
||||
const authParams = oauth.authorize(requestData, token as OAuth.Token | undefined);
|
||||
|
||||
Reference in New Issue
Block a user