Badisi / auth-js

🛡️ Authentication and authorization support for web based desktop and mobile applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Query params are duplicated after redirect

ms-emp opened this issue · comments

Is there an existing issue for this?

  • I have searched the existing issues

Library version

3.0.0-alpha.1

Description

When the user navigates to a protected page and includes some query parameters, the query parameters are duplicated when he comes back to the app after logging in.

Steps to reproduce

See this test app, clone, run, log in using credentials from here, click on Logout, then click on Page 2 with params and see the output on the page.

Environment

  • Angular version: 16

So I found the bug.

In AuthService line 167 absUrl already contains the query string so we shouldn't append value.search.

image

Thanks for the investigation !
I'll try to find some time in the upcoming days to have a look into it.

Hi,

I created a fix branch, but I'm getting a 403 when I try to push the branch to GitHub?!

Also, how can I fork the source code for version 3.0.0-alpha.1?

@Badisi

Can you please review this PR? #36

I've been really busy these past few months and I haven't had any time to dedicate to this library, unfortunately..
I'll do my best to get everything sorted out this week.
Thanks for the PR, and sorry for the inconvenience.

Issue must have been introduced after Angular 14 (because I can reproduce it with Angular 16 but not Angular 14).

URL.href is returning the whole url anyway, so there is definitely no need to add search params.

Fix will be available in the next release.

Also, the Angular demo app now has a query params settings to play with:
https://badisi.github.io/auth-js/demo-app/ngx-auth

🎉 Released in @badisi/ngx-auth@2.0.0 📦🚀