Skip to content

Commit 8807432

Browse files
authored
Merge pull request #22853 from abpframework/issue/22850
Angular - Fixing the garbage query problem in the code flow
2 parents 1a1350e + 00fd49d commit 8807432

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

npm/ng-packs/packages/oauth/src/lib/strategies/auth-code-flow-strategy.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,13 @@ export class AuthCodeFlowStrategy extends AuthFlowStrategy {
5050
const location = this.windowService.window.location;
5151
const history = this.windowService.window.history;
5252

53-
const href =
54-
location.origin +
55-
location.pathname +
56-
location.search
57-
.replace(/iss=[^&$]*/, '')
58-
.replace(/culture=[^&$]*/, '')
59-
.replace(/ui-culture=[^&$]*/, '') +
60-
location.hash;
53+
const query = location.search
54+
.replace(/([?&])iss=[^&]*&?/, '$1')
55+
.replace(/([?&])culture=[^&]*&?/, '$1')
56+
.replace(/([?&])ui-culture=[^&]*&?/, '$1')
57+
.replace(/[?&]+$/, '');
58+
59+
const href = location.origin + location.pathname + query + location.hash;
6160

6261
history.replaceState(null, '', href);
6362
}

0 commit comments

Comments
 (0)