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

userFromToken 无法使用 #12

Open
sinkcup opened this issue Sep 4, 2019 · 2 comments
Open

userFromToken 无法使用 #12

sinkcup opened this issue Sep 4, 2019 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@sinkcup
Copy link
Member

sinkcup commented Sep 4, 2019

@apollopy 提出:

sinkcup/sinkcup.github.io#12 (comment)

由于微信并不能光用 token 拿到用户信息,还需要传递 openid。原包里

https://github.com/SocialiteProviders/Providers/blob/master/src/Weixin/Provider.php#L133

https://github.com/SocialiteProviders/Providers/blob/master/src/Weixin/Provider.php#L30-L33

这两段,保证了我既能用过 user() 函数直接实现。也能在已知 openid 和 token 的情况下,自己 new 这个类,通过 userFromToken 拿到 Laravel\Socialite\AbstractUser

而 credentialsResponseBody 目前是没办法在外部设置的。导致抽象类里的 https://github.com/laravel/socialite/blob/4.0/src/Two/AbstractProvider.php#L230
作为一个 public 函数,完全没办法使用

@sinkcup sinkcup self-assigned this Sep 4, 2019
@sinkcup
Copy link
Member Author

sinkcup commented Sep 4, 2019

看了下 laravel 文档:https://laravel.com/docs/6.0/socialite#retrieving-user-details

当有 token 时,可以去查询用户资料:

$user = Socialite::driver('github')->userFromToken($token);

而本 package 未实现这一点,只实现了 登录时获取用户资料。

@sinkcup sinkcup added the enhancement New feature or request label Sep 4, 2019
@sinkcup
Copy link
Member Author

sinkcup commented Sep 4, 2019

看了下 GitHub、Facebook、Google 的 API,获取用户资料都是根据 token 即可,而不需要 user id。微信又破坏标准了……需要 HACK @apollopy

sinkcup added a commit that referenced this issue Sep 4, 2019
sinkcup added a commit that referenced this issue Sep 4, 2019
sinkcup added a commit that referenced this issue Sep 4, 2019
sinkcup added a commit that referenced this issue Sep 4, 2019
sinkcup added a commit that referenced this issue Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant