python - How to pass anti-forgery state to the Google Sign-In button or javascript? -


i'm following tutorial create sign-in button.

https://developers.google.com/+/web/signin/server-side-flow

but don't see how anti-forgery state passed button snippet (step 4).

should there parameter data-state button?

the whole tutorial doesn't mention how state code passed page google server , signincallback function.

<div id="signinbutton">   <span class="g-signin"         data-scope="https://www.googleapis.com/auth/plus.login"         data-clientid="your_client_id"         data-redirecturi="postmessage"         data-accesstype="offline"         data-cookiepolicy="single_host_origin"         data-callback="signincallback">   </span> </div> 

then in step 6, don't see how state passed ajax server call. how if-condition work in step 7?

if request.args.get('state', '') != session['state']:

thanks in advance.

after little poking around, found there's undocumented parameter, data-state, button. once set it, coming callback function.

<div id="signinbutton">   <span class="g-signin"         data-scope="https://www.googleapis.com/auth/plus.login"         data-clientid="your_client_id"         data-state="my_state" <!-- state sent google , callback -->         data-redirecturi="postmessage"         data-accesstype="offline"         data-cookiepolicy="single_host_origin"         data-callback="signincallback">   </span> </div> 

Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -