Skip to content

Commit 5248021

Browse files
authored
fix: use email and id.username scopes as defaults (#61)
They are should be always present to have claims used in user name rendering on Authentication settings page Signed-off-by: Denis Golovin <[email protected]>
1 parent 7fbfacd commit 5248021

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/authentication-service.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -324,10 +324,12 @@ export class RedHatAuthenticationService {
324324
const code_verifier = generators.codeVerifier();
325325
const code_challenge = generators.codeChallenge(code_verifier);
326326

327+
// email and id.username scopes required to render user name on Authentication Settings page
328+
const defaultScopes = 'openid id.username email';
327329
const scope = scopes;
328330

329331
const authUrl = this.client.authorizationUrl({
330-
scope: `openid ${scope}`,
332+
scope: `${defaultScopes} ${scope}`,
331333
resource: this.config.apiUrl,
332334
code_challenge,
333335
code_challenge_method: 'S256',

src/extension.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ async function signIntoRedHatDeveloperAccount(createIfNone = true): Promise<exte
6363
return extensionApi.authentication.getSession(
6464
'redhat.authentication-provider',
6565
['api.iam.registry_service_accounts', //scope that gives access to hydra service accounts API
66-
'api.console', // scope that gives access to console.redhat.com APIs
67-
'id.username'], // adds claim to accessToken that used to render account label
66+
'api.console'], // scope that gives access to console.redhat.com APIs
6867
{createIfNone} // will request to login in browser if session does not exists
6968
);
7069
}

0 commit comments

Comments
 (0)