Answer the question
In order to leave comments, you need to log in
How to automatically submit a form after a redirect from an oauth provider?
Hey!
There is a form on the page. It is necessary that only an authorized user can send it.
So the scenario:
Step 1: The user is not currently authorized, fills out the form, clicks "Submit", a modal login window appears (login / password or login via social networks).
Step 2: The user clicks on the icon of the social network, passes the authorization of the outh-provider and at the end it is redirected back to the desired page
Step 3. The desired page understands that the user is now logged into the site and AUTOMATICALLY sends the completed form to the server.
Here with the third step crutches turn out. It is necessary to somehow save the data of the completed form before the redirect. Then, after a reverse redirect, the page you are looking for should understand that now you need to immediately submit the form.
As I did now:
Before redirecting, I save the serialized form into a temporary cookie, and also set the session variable-"marker" $_SESSION['autosubmit'] = true. When I return to the page I'm looking for, I check the values of variables and cookies - and submit the form.
The feeling that this is a crooked path does not leave.
Share your experience? What is the best way to organize this process?
Answer the question
In order to leave comments, you need to log in
If server authorization, then you can use state to transfer information after the redirect. For example, that this is a redirect with the form such and such, the data is such and such.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question