You need to serialize the values โโof the form and RedirectUrl into a hidden field.
After authentication, deserialize the data in a hidden field and redirect based on the value of RedirectUrl.
For this you need a special authorization class.
source share