A
A
Alexander2016-06-01 21:45:49
Facebook
Alexander, 2016-06-01 21:45:49

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?
77baeb1c1b.jpg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ilya, 2016-06-01
@FireGM

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.

R
Rou1997, 2016-06-01
@Rou1997

Of course, the curve, first entering, then filling out the form, in general, "client" data should be stored on the client side, in localstorage.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question