How to Create an anti-request forgery state token In google+ server side sign-up

本小妞迷上赌 提交于 2019-11-28 12:55:16

I believe the issue is with the documentation providing you incomplete code snippets (I've opened a bug about that). That particular sample relies on Symfony, which is what you're encountering with the missing variable/method.

The PHP Quickstart provides the full instructions to get this particular sample set up. You can also get the full source code from Github.

You don't have to use Symfony of course but if you choose to go with native PHP methods, you'd need to update the references to $request, $app, and other Symfony methods that the sample uses.

UPDATE:

SignIn/SignUp links:

  1. http://www.w3resource.com/API/google-plus/tutorial.php
  2. http://rscavilla.blogspot.in/2011/06/using-oauth-20-with-php-to-authenticate.html

To get user info:

Look at this code to get the user-info from the Google+ API.

The problem is you don't have a $app object on your application that can call the set method when your app is trying to set the state in the session.

That said, the documentation on the google side tells the user who reads the document to ensure that state value is stored in their application session and how the other required value for the google_auth API should be stored.

Tutorial:

Take a look into this link for more detailed tutorial on how to configure and use Google OAuth API.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!