Skip to content

Commit

Permalink
feat: Add prompt=none to Discord OAuth authorization URL
Browse files Browse the repository at this point in the history
  • Loading branch information
f-fsantos committed Jul 21, 2024
1 parent 22cd54c commit 4c65569
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/phases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class LoginPhase extends Phase {
}, () => {
const redirectUri = encodeURIComponent(`${import.meta.env.VITE_SERVER_URL}/auth/discord/callback`);
const discordId = import.meta.env.VITE_DISCORD_CLIENT_ID;
const discordUrl = `https://discord.com/api/oauth2/authorize?client_id=${discordId}&redirect_uri=${redirectUri}&response_type=code&scope=identify`;
const discordUrl = `https://discord.com/api/oauth2/authorize?client_id=${discordId}&redirect_uri=${redirectUri}&response_type=code&scope=identify&prompt=none`;
window.open(discordUrl, "_self");
}, () => {
const redirectUri = encodeURIComponent(`${import.meta.env.VITE_SERVER_URL}/auth/google/callback`);
Expand Down
2 changes: 1 addition & 1 deletion src/ui/login-form-ui-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default class LoginFormUiHandler extends FormModalUiHandler {
discordImage.on("pointerdown", () => {
const redirectUri = encodeURIComponent(`${import.meta.env.VITE_SERVER_URL}/auth/discord/callback`);
const discordId = import.meta.env.VITE_DISCORD_CLIENT_ID;
const discordUrl = `https://discord.com/api/oauth2/authorize?client_id=${discordId}&redirect_uri=${redirectUri}&response_type=code&scope=identify`;
const discordUrl = `https://discord.com/api/oauth2/authorize?client_id=${discordId}&redirect_uri=${redirectUri}&response_type=code&scope=identify&prompt=none`;
window.open(discordUrl, "_self");
});
this.discordImage = discordImage;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/menu-ui-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ export default class MenuUiHandler extends MessageUiHandler {
const token = Utils.getCookie(Utils.sessionIdKey);
const redirectUri = encodeURIComponent(`${import.meta.env.VITE_SERVER_URL}/auth/discord/callback`);
const discordId = import.meta.env.VITE_DISCORD_CLIENT_ID;
const discordUrl = `https://discord.com/api/oauth2/authorize?client_id=${discordId}&redirect_uri=${redirectUri}&response_type=code&scope=identify&state=${token}`;
const discordUrl = `https://discord.com/api/oauth2/authorize?client_id=${discordId}&redirect_uri=${redirectUri}&response_type=code&scope=identify&state=${token}&prompt=none`;
window.open(discordUrl, "_self");
return true;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ export const isBeta = import.meta.env.MODE === "beta"; // this checks to see if
export function setCookie(cName: string, cValue: string): void {
const expiration = new Date();
expiration.setTime(new Date().getTime() + 3600000 * 24 * 30 * 3/*7*/);
document.cookie = `${cName}=${cValue};Secure;SameSite=Strict;Path=/;Expires=${expiration.toUTCString()}`;
document.cookie = `${cName}=${cValue};Secure;SameSite=Strict;Domain=beta.pokerogue.net;Path=/;Expires=${expiration.toUTCString()}`;
}

export function getCookie(cName: string): string {
Expand Down

0 comments on commit 4c65569

Please sign in to comment.