Saturday 15 August 2015

oauth 2.0 - Setting up laravel-oauth2 (facebook login), running into errors -


I'm trying to establish the oauth2 authentication system (especially for Facebook) for Laravel 4:

I have a controller, Oauth2Controller.php, which controls this. I am trying to include the necessary files in the package in my controller. After the example of that repository, I use it:

  OAuth2 \ OAuth2; OAuth2 \ Token_Access; Use OAuth2 \ exception as OAuth2_Exception; However, when I run the page, it's throwing an error for these lines saying:  
  symphony \ component \ debug \ Exceptions \ FatalErrorException syntax error, unexpected 'as' (T_AS), ',' or ';' Or '{'   

This directly references the third line: use OAuth2 \ exception as OAuth2_Exception;

I'm not sure why this error is throwing.

Here is the complete code for my controller:

   ; '***************',)); If (! Isset ($ _ GET ['code'])) {return $ provider-> Authorize (); } Else {// Howzit? {$ Params = $ provider-> Try Access ($ _GET ['code']); $ Tokens = New Token_Access (array ('access_token' = & gt; $ params- & gt; Access_token)); $ User = $ provider- & gt; Get_user_info ($ token); // Here you should use A of this information A) Search for the user) Help sign up a new user with existing data // If you store it in a cookie and redirect to a registration page If it is nuts-it is simple-echo "prefix"; Var_dump (user $); } Hold (OAuth2_Exception $ e) {show_error ('that does not work:'. $ E); On my way, to get to the page, I have:  
  Root :: find ('oauth / {provider} ',' Oether 2 Cittorator @ Mill Index ');   

Thank you for your help and insights!

I try to keep three sections above class .

They need to import a namespace for use in their class:

  use  Class & gt ;; Use & lt; Class & gt; As {a_class} ... class & lt; Name & gt; ... {   

No comments:

Post a Comment