Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use state instead of cid for oauth1 callback #3354

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions packages/cli/src/Server.ts
Expand Up @@ -1746,7 +1746,7 @@ class App {
const oauthRequestData = {
oauth_callback: `${WebhookHelpers.getWebhookBaseUrl()}${
this.restEndpoint
}/oauth1-credential/callback?cid=${credentialId}`,
}/oauth1-credential/callback?state=${credentialId}`,
};

await this.externalHooks.run('oauth1.authenticate', [oAuthOptions, oauthRequestData]);
Expand Down Expand Up @@ -1805,7 +1805,7 @@ class App {
`/${this.restEndpoint}/oauth1-credential/callback`,
async (req: OAuthRequest.OAuth1Credential.Callback, res: express.Response) => {
try {
const { oauth_verifier, oauth_token, cid: credentialId } = req.query;
const { oauth_verifier, oauth_token, state: credentialId } = req.query;

if (!oauth_verifier || !oauth_token) {
const errorResponse = new ResponseHelper.ResponseError(
Expand Down Expand Up @@ -1916,7 +1916,7 @@ class App {
} catch (error) {
LoggerProxy.error('OAuth1 callback failed because of insufficient user permissions', {
userId: req.user?.id,
credentialId: req.query.cid,
credentialId: req.query.state,
});
// Error response
return ResponseHelper.sendErrorResponse(res, error);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/requests.d.ts
Expand Up @@ -236,7 +236,7 @@ export declare namespace OAuthRequest {
{},
{},
{},
{ oauth_verifier: string; oauth_token: string; cid: string }
{ oauth_verifier: string; oauth_token: string; state: string }
> & {
user?: User;
};
Expand Down