cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How To redirect to previous URL after CDC Login

Eldhos
Participant
1,001

Hi Team,

I have a scenario,

1. User will be accessing my account page directly from URL.

2. System will Automatically navigate back to the Login page as User Is not authorized

3. After Entering valid credentials, User Should Navigate to the previous incoming URL, That is, My account.

This functionality is working with hybris(Spring Feature), However, I need to implement the same with CDC Screenset Login.

Can Anyone help me here?

Thanks In advance

Accepted Solutions (0)

Answers (1)

Answers (1)

dhruv2397
Explorer

Hi Eldhos,

If webSDK CDC Screensets are being used, post login by default, the user will land from where the screenset was initiated.

However, to customize this behaviour you may use the onLogin event handler to redirect the user to the correct subpage. You may modify the onLogin event from WebSDK configuration [Ref: 1] or from the page where the screensets are rendered [Ref: 2].

The redirect value can be stored within the cookies or as a sessional parameter value in the same domain in which the screensets are being rendered. Post Login, the onLogin event handler is fired, and you may pull the redirect value from the cookies or session storage and redirect the user to the correct subpage.

More information related to the event handlers, can be found here.

Thanks and Regards,

Dhruv Jain

Eldhos
Participant
0 Kudos

Thanks for the response.

But my challenge is, How to get the previous URL. If I am able to get it, Even, I Can get it via javascript variable. Kindly help here

dhruv2397
Explorer
0 Kudos

So, as I understood from your comment, the user is directly accessing the My Account URL and will be redirected to some other URL for logging in (this means the domains for both these URL's are different), correct?