Open shengyou opened 10 years ago
What I had to do to fix it was to change references to Client\Provider\User to Client\Entity\User in:
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
Thanks for help!
I follow your step to change
And then still meet the problem like before, so I continue change "Provider" to "Entity" in
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!
@shengyou Did you ever find a fix for this? I'm experiencing the same problem.
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!