Skip to content

Commit 8a64eff

Browse files
committed
Avoid using both forceNewSession and createIfNone
1 parent ac72310 commit 8a64eff

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/auth/auth.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ const DEFAULT_SCOPES = ["repo", "workflow"];
99
* @returns A {@link vscode.AuthenticationSession}
1010
*/
1111
export async function getSession(forceMessage?: string): Promise<vscode.AuthenticationSession> {
12-
const existingSession = await vscode.authentication.getSession(AUTH_PROVIDER_ID, getScopes(), {
13-
createIfNone: true,
14-
forceNewSession: forceMessage ? {detail: forceMessage} : false
15-
});
12+
// forceNewSession and createIfNone are mutually exclusive
13+
const options: vscode.AuthenticationGetSessionOptions = forceMessage
14+
? {forceNewSession: {detail: forceMessage}}
15+
: {createIfNone: true};
16+
const existingSession = await vscode.authentication.getSession(AUTH_PROVIDER_ID, getScopes(), options);
1617

1718
if (!existingSession) {
1819
throw new Error("Could not get token from the GitHub authentication provider. \nPlease sign-in and allow access.");

0 commit comments

Comments
 (0)