Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help: Github login fail #67

Open
shengyou opened this issue Jun 18, 2014 · 3 comments
Open

Help: Github login fail #67

shengyou opened this issue Jun 18, 2014 · 3 comments

Comments

@shengyou
Copy link

Hi,

I just try to run a local copy of laravel-tricks on my laptop.
Everything looks fine (ex. register, login, create trick), but only fail on login with github.

When login with github, the page will redirect to '/login/github' with code & state get params.
And show "Argument 1 passed to Tricks\Repositories\Eloquent\UserRepository::createFromGithubData() must be an instance of League\OAuth2\Client\Provider\User, instance of League\OAuth2\Client\Entity\User given, called in .../app/Tricks/Services/Social/Github.php on line 95 and defined"
(The screenshot has attached)

I had setup 'clientId', 'clientSecret' and 'user_agent' correctly in app/config/social.php, but can't find out how this error happen.
Any suggestions would be greatly appreciated! Thanks!

screen shot 2014-06-18 at 10 32 57 pm

@jjordansd
Copy link

What I had to do to fix it was to change references to Client\Provider\User to Client\Entity\User in:

  • Tricks\Repositories\Eloquent\ProfileRepository.php
  • Tricks\Repositories\Eloquent\UserRepository.php

The begining of the file should look like this:
namespace Tricks\Repositories\Eloquent;

use Tricks\User;
use Tricks\Profile;
use Tricks\Repositories\ProfileRepositoryInterface;
use League\OAuth2\Client\Entity\User as OAuthUser;
class UserRepository extends AbstractRepository implements UserRepositoryInterface
and
class ProfileRepository extends AbstractRepository implements ProfileRepositoryInterface

Then in the ProfileRepository.php file you will need to update the OAuthUser ($details) fields:
$profile->first_name = $details->firstName;
$profile->last_name = $details->lastName;

(no underscore on the left side of the assignment). Good luck.

Jacques

@shengyou
Copy link
Author

shengyou commented Jul 7, 2014

Thanks for help!

I follow your step to change

  • Tricks\Repositories\Eloquent\ProfileRepository.php
  • Tricks\Repositories\Eloquent\UserRepository.php
    included OAuthUser ($details) fields

And then still meet the problem like before, so I continue change "Provider" to "Entity" in

  • Tricks\Repositories\UserRepositoryInterface.php
  • Tricks\Repositories\ProfileRepositoryInterface.php

Then I meet this problem:
League\OAuth2\Client\Entity\User does not contain a property by the name of "image_url"
in vendor/league/oauth2-client/src/Entity/User.php

Still can't fix this problem, did I do something wrong?
Or any other suggestions? Thanks!

@michaelharper
Copy link

@shengyou Did you ever find a fix for this? I'm experiencing the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants