File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
packages/mcp-server-utils/src Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -691,9 +691,13 @@ async function pollForToken(
691
691
/**
692
692
* Returns the OAuth scopes we need for the issuer.
693
693
*
694
- * This will always include "openid profile" but some providers may need other
695
- * scopes to make the user email available. We require the user email for the
696
- * token to be valid.
694
+ * In general this is "openid profile offline_access", but some providers may
695
+ * require different scopes for idiosyncratic reasons.
696
+ *
697
+ * We require two things that are driven by scopes:
698
+ *
699
+ * - user email (openid profile)
700
+ * - refresh tokens (offline_access)
697
701
*/
698
702
export function getOAuthScopes ( config : GleanOAuthConfig ) : string {
699
703
const { issuer : issuer } = config ;
@@ -707,7 +711,7 @@ export function getOAuthScopes(config: GleanOAuthConfig): string {
707
711
case 'okta.com' :
708
712
return 'openid profile offline_access' ;
709
713
default :
710
- return 'openid profile' ;
714
+ return 'openid profile offline_access ' ;
711
715
}
712
716
}
713
717
Original file line number Diff line number Diff line change @@ -658,7 +658,9 @@ describe('auth', () => {
658
658
authType : 'oauth' as const ,
659
659
baseUrl : 'https://api.example.com' ,
660
660
} ;
661
- expect ( getOAuthScopes ( config ) ) . toMatchInlineSnapshot ( `"openid profile"` ) ;
661
+ expect ( getOAuthScopes ( config ) ) . toMatchInlineSnapshot (
662
+ `"openid profile offline_access"` ,
663
+ ) ;
662
664
} ) ;
663
665
} ) ;
664
666
You can’t perform that action at this time.
0 commit comments