Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ const handler = createSmartRouteHandler({
callbackResult = await providerObj.getCallback({
codeVerifier: innerCodeVerifier,
state: innerState,
extraScope: providerScope,
callbackParams: {
...query,
...body,
Expand Down
11 changes: 9 additions & 2 deletions apps/backend/src/oauth/providers/base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ export abstract class OAuthBaseProvider {
callbackParams: CallbackParamsType,
codeVerifier: string,
state: string,
extraScope?: string,
}): Promise<{ userInfo: OAuthUserInfo, tokenSet: TokenSet }> {
let tokenSet;
const callbackParams = { ...options.callbackParams };
Expand All @@ -410,11 +411,17 @@ export abstract class OAuthBaseProvider {
},
] as const;

const callbackExtras = {
exchangeBody: {
scope: mergeScopeStrings(this.scope, options.extraScope ?? ""),
},
};
Comment on lines +414 to +418
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Minor style inconsistency: getAuthorizationUrl (line 372) uses || "" for the same fallback, while the new code here uses ?? "". Both are functionally equivalent for string scopes, but aligning them keeps the two code sites consistent.

Suggested change
const callbackExtras = {
exchangeBody: {
scope: mergeScopeStrings(this.scope, options.extraScope ?? ""),
},
};
const callbackExtras = {
exchangeBody: {
scope: mergeScopeStrings(this.scope, options.extraScope || ""),
},
};
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/backend/src/oauth/providers/base.tsx
Line: 414-418

Comment:
Minor style inconsistency: `getAuthorizationUrl` (line 372) uses `|| ""` for the same fallback, while the new code here uses `?? ""`. Both are functionally equivalent for string scopes, but aligning them keeps the two code sites consistent.

```suggestion
    const callbackExtras = {
      exchangeBody: {
        scope: mergeScopeStrings(this.scope, options.extraScope || ""),
      },
    };
```

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!


try {
if (this.openid) {
tokenSet = await this.oauthClient.callback(...params);
tokenSet = await this.oauthClient.callback(...params, callbackExtras);
} else {
tokenSet = await this.oauthClient.oauthCallback(...params);
tokenSet = await this.oauthClient.oauthCallback(...params, callbackExtras);
}
} catch (error: any) {
if (error?.error === "invalid_grant" || error?.error?.error === "invalid_grant") {
Expand Down
Loading