From e2336233555eb882de2ba9210d25ceba484331c7 Mon Sep 17 00:00:00 2001 From: Raf Baluyot Date: Mon, 19 Feb 2024 13:40:09 +0100 Subject: [PATCH] Fix auth and logout urls not being formatted correctly if it has a query parameter --- src/schemes/oauth2.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/schemes/oauth2.ts b/src/schemes/oauth2.ts index 2c910207f..8f448adb3 100644 --- a/src/schemes/oauth2.ts +++ b/src/schemes/oauth2.ts @@ -303,8 +303,8 @@ export class Oauth2Scheme< this.$auth.$storage.setUniversal(this.name + '.state', opts.state) - const url = this.options.endpoints.authorization + '?' + encodeQuery(opts) - + const urlConcat = this.options.endpoints.authorization.includes('?') ? '&' : '?'; + const url = this.options.endpoints.authorization + urlConcat + encodeQuery(opts) window.location.replace(url) } @@ -314,7 +314,8 @@ export class Oauth2Scheme< client_id: this.options.clientId + '', logout_uri: this.logoutRedirectURI } - const url = this.options.endpoints.logout + '?' + encodeQuery(opts) + const urlConcat = this.options.endpoints.logout.includes('?') ? '&' : '?'; + const url = this.options.endpoints.logout + urlConcat + encodeQuery(opts) window.location.replace(url) } return this.$auth.reset()