{"action":"created","comment":{"url":"https://api.github.com/repos/overtrue/socialite/pulls/comments/90771255","pull_request_review_id":11289163,"id":90771255,"diff_hunk":"@@ -0,0 +1,218 @@\n+<?php\n+\n+/*\n+ * This file is part of the overtrue/socialite.\n+ *\n+ * (c) overtrue <i@overtrue.me>\n+ *\n+ * This source file is subject to the MIT license that is bundled\n+ * with this source code in the file LICENSE.\n+ */\n+\n+namespace Overtrue\\Socialite\\Providers;\n+\n+use Overtrue\\Socialite\\AccessToken;\n+use Overtrue\\Socialite\\AccessTokenInterface;\n+use Overtrue\\Socialite\\InvalidArgumentException;\n+use Overtrue\\Socialite\\ProviderInterface;\n+use Overtrue\\Socialite\\User;\n+\n+/**\n+ * Class WeChatProvider.\n+ *\n+ * @link http://mp.weixin.qq.com/wiki/9/01f711493b5a02f24b04365ac5d8fd95.html [WeChat - 公众平台OAuth文档]\n+ * @link https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419316505&token=&lang=zh_CN [网站应用微信登录开发指南]\n+ */\n+class CorpWechatProvider extends AbstractProvider implements ProviderInterface\n+{\n+    /**\n+     * The base url of WeChat API.\n+     *\n+     * @var string\n+     */\n+    protected $user_baseinfo_api = 'https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo';\n+    protected $user_info_api = 'https://qyapi.weixin.qq.com/cgi-bin/user/get';\n+    protected $access_api_url = 'https://qyapi.weixin.qq.com/cgi-bin/gettoken';\n+\n+    /**\n+     * {@inheritdoc}.\n+     */\n+    protected $openId;\n+\n+    /**\n+     * {@inheritdoc}.\n+     */\n+    protected $scopes = ['snsapi_base'];\n+\n+    /**\n+     * Indicates if the session state should be utilized.\n+     *\n+     * @var bool\n+     */\n+    protected $stateless = true;\n+\n+    /**\n+     * {@inheritdoc}.\n+     */\n+    protected function getAuthUrl($state)\n+    {\n+        $path = 'oauth2/authorize';\n+\n+        $url = \"https://open.weixin.qq.com/connect/{$path}\";\n+        // dd($url);","path":"src/Providers/CorpWeChatProvider.php","position":62,"original_position":62,"commit_id":"ac6d2de2eaed366749a44a37a4c3328ead46addd","original_commit_id":"ac6d2de2eaed366749a44a37a4c3328ead46addd","user":{"login":"overtrue","id":1472352,"avatar_url":"https://avatars.githubusercontent.com/u/1472352?v=3","gravatar_id":"","url":"https://api.github.com/users/overtrue","html_url":"https://github.com/overtrue","followers_url":"https://api.github.com/users/overtrue/followers","following_url":"https://api.github.com/users/overtrue/following{/other_user}","gists_url":"https://api.github.com/users/overtrue/gists{/gist_id}","starred_url":"https://api.github.com/users/overtrue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/overtrue/subscriptions","organizations_url":"https://api.github.com/users/overtrue/orgs","repos_url":"https://api.github.com/users/overtrue/repos","events_url":"https://api.github.com/users/overtrue/events{/privacy}","received_events_url":"https://api.github.com/users/overtrue/received_events","type":"User","site_admin":false},"body":"？","created_at":"2016-12-04T05:54:07Z","updated_at":"2016-12-04T05:54:07Z","html_url":"https://github.com/overtrue/socialite/pull/33#discussion_r90771255","pull_request_url":"https://api.github.com/repos/overtrue/socialite/pulls/33","_links":{"self":{"href":"https://api.github.com/repos/overtrue/socialite/pulls/comments/90771255"},"html":{"href":"https://github.com/overtrue/socialite/pull/33#discussion_r90771255"},"pull_request":{"href":"https://api.github.com/repos/overtrue/socialite/pulls/33"}}},"pull_request":{"url":"https://api.github.com/repos/overtrue/socialite/pulls/33","id":96396661,"html_url":"https://github.com/overtrue/socialite/pull/33","diff_url":"https://github.com/overtrue/socialite/pull/33.diff","patch_url":"https://github.com/overtrue/socialite/pull/33.patch","issue_url":"https://api.github.com/repos/overtrue/socialite/issues/33","number":33,"state":"open","locked":false,"title":"添加微信企业号的 oauth登录","user":{"login":"shoaly","id":2660914,"avatar_url":"https://avatars.githubusercontent.com/u/2660914?v=3","gravatar_id":"","url":"https://api.github.com/users/shoaly","html_url":"https://github.com/shoaly","followers_url":"https://api.github.com/users/shoaly/followers","following_url":"https://api.github.com/users/shoaly/following{/other_user}","gists_url":"https://api.github.com/users/shoaly/gists{/gist_id}","starred_url":"https://api.github.com/users/shoaly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shoaly/subscriptions","organizations_url":"https://api.github.com/users/shoaly/orgs","repos_url":"https://api.github.com/users/shoaly/repos","events_url":"https://api.github.com/users/shoaly/events{/privacy}","received_events_url":"https://api.github.com/users/shoaly/received_events","type":"User","site_admin":false},"body":"` $config = [\r\n                    'corp-wechat' => [\r\n                        // 'open_platform' => $pimple['config']['open_platform'],\r\n                        'client_id' => config('corp-wechat.corp_id'),\r\n                        'client_secret' => config('corp-wechat.secret'),\r\n                        'redirect' => config('corp-wechat.oauth.callback'),\r\n                    ],\r\n                    'longlive_access_token'=>false,\r\n                ];\r\n\r\n        $this->socialite = (new Socialite($config));`\r\n\r\n由于企业号那边会用到7200秒的那个access_token, 所以在构建config的时候添加一个longlive_access_token 可以传入. 这样的好处是之后写兼容overtrue/wechat的时候, 不会反复调用 getAccessToken() 引起冲突","created_at":"2016-12-03T12:38:17Z","updated_at":"2016-12-04T05:59:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7e438257c25d2e946e58aa29d31767de859497ba","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/overtrue/socialite/pulls/33/commits","review_comments_url":"https://api.github.com/repos/overtrue/socialite/pulls/33/comments","review_comment_url":"https://api.github.com/repos/overtrue/socialite/pulls/comments{/number}","comments_url":"https://api.github.com/repos/overtrue/socialite/issues/33/comments","statuses_url":"https://api.github.com/repos/overtrue/socialite/statuses/ac6d2de2eaed366749a44a37a4c3328ead46addd","head":{"label":"shoaly:dev","ref":"dev","sha":"ac6d2de2eaed366749a44a37a4c3328ead46addd","user":{"login":"shoaly","id":2660914,"avatar_url":"https://avatars.githubusercontent.com/u/2660914?v=3","gravatar_id":"","url":"https://api.github.com/users/shoaly","html_url":"https://github.com/shoaly","followers_url":"https://api.github.com/users/shoaly/followers","following_url":"https://api.github.com/users/shoaly/following{/other_user}","gists_url":"https://api.github.com/users/shoaly/gists{/gist_id}","starred_url":"https://api.github.com/users/shoaly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shoaly/subscriptions","organizations_url":"https://api.github.com/users/shoaly/orgs","repos_url":"https://api.github.com/users/shoaly/repos","events_url":"https://api.github.com/users/shoaly/events{/privacy}","received_events_url":"https://api.github.com/users/shoaly/received_events","type":"User","site_admin":false},"repo":{"id":75459138,"name":"socialite","full_name":"shoaly/socialite","owner":{"login":"shoaly","id":2660914,"avatar_url":"https://avatars.githubusercontent.com/u/2660914?v=3","gravatar_id":"","url":"https://api.github.com/users/shoaly","html_url":"https://github.com/shoaly","followers_url":"https://api.github.com/users/shoaly/followers","following_url":"https://api.github.com/users/shoaly/following{/other_user}","gists_url":"https://api.github.com/users/shoaly/gists{/gist_id}","starred_url":"https://api.github.com/users/shoaly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shoaly/subscriptions","organizations_url":"https://api.github.com/users/shoaly/orgs","repos_url":"https://api.github.com/users/shoaly/repos","events_url":"https://api.github.com/users/shoaly/events{/privacy}","received_events_url":"https://api.github.com/users/shoaly/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/shoaly/socialite","description":":octocat: Socialite is an OAuth2 Authentication tool. It is inspired by laravel/socialite, you can easily use it without Laravel.","fork":true,"url":"https://api.github.com/repos/shoaly/socialite","forks_url":"https://api.github.com/repos/shoaly/socialite/forks","keys_url":"https://api.github.com/repos/shoaly/socialite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shoaly/socialite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shoaly/socialite/teams","hooks_url":"https://api.github.com/repos/shoaly/socialite/hooks","issue_events_url":"https://api.github.com/repos/shoaly/socialite/issues/events{/number}","events_url":"https://api.github.com/repos/shoaly/socialite/events","assignees_url":"https://api.github.com/repos/shoaly/socialite/assignees{/user}","branches_url":"https://api.github.com/repos/shoaly/socialite/branches{/branch}","tags_url":"https://api.github.com/repos/shoaly/socialite/tags","blobs_url":"https://api.github.com/repos/shoaly/socialite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shoaly/socialite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shoaly/socialite/git/refs{/sha}","trees_url":"https://api.github.com/repos/shoaly/socialite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shoaly/socialite/statuses/{sha}","languages_url":"https://api.github.com/repos/shoaly/socialite/languages","stargazers_url":"https://api.github.com/repos/shoaly/socialite/stargazers","contributors_url":"https://api.github.com/repos/shoaly/socialite/contributors","subscribers_url":"https://api.github.com/repos/shoaly/socialite/subscribers","subscription_url":"https://api.github.com/repos/shoaly/socialite/subscription","commits_url":"https://api.github.com/repos/shoaly/socialite/commits{/sha}","git_commits_url":"https://api.github.com/repos/shoaly/socialite/git/commits{/sha}","comments_url":"https://api.github.com/repos/shoaly/socialite/comments{/number}","issue_comment_url":"https://api.github.com/repos/shoaly/socialite/issues/comments{/number}","contents_url":"https://api.github.com/repos/shoaly/socialite/contents/{+path}","compare_url":"https://api.github.com/repos/shoaly/socialite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shoaly/socialite/merges","archive_url":"https://api.github.com/repos/shoaly/socialite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shoaly/socialite/downloads","issues_url":"https://api.github.com/repos/shoaly/socialite/issues{/number}","pulls_url":"https://api.github.com/repos/shoaly/socialite/pulls{/number}","milestones_url":"https://api.github.com/repos/shoaly/socialite/milestones{/number}","notifications_url":"https://api.github.com/repos/shoaly/socialite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shoaly/socialite/labels{/name}","releases_url":"https://api.github.com/repos/shoaly/socialite/releases{/id}","deployments_url":"https://api.github.com/repos/shoaly/socialite/deployments","created_at":"2016-12-03T07:28:08Z","updated_at":"2016-12-03T07:28:09Z","pushed_at":"2016-12-03T12:35:15Z","git_url":"git://github.com/shoaly/socialite.git","ssh_url":"git@github.com:shoaly/socialite.git","clone_url":"https://github.com/shoaly/socialite.git","svn_url":"https://github.com/shoaly/socialite","homepage":"","size":101,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"overtrue:master","ref":"master","sha":"1426daa1a9ac4045718d4c318c71b2612f297123","user":{"login":"overtrue","id":1472352,"avatar_url":"https://avatars.githubusercontent.com/u/1472352?v=3","gravatar_id":"","url":"https://api.github.com/users/overtrue","html_url":"https://github.com/overtrue","followers_url":"https://api.github.com/users/overtrue/followers","following_url":"https://api.github.com/users/overtrue/following{/other_user}","gists_url":"https://api.github.com/users/overtrue/gists{/gist_id}","starred_url":"https://api.github.com/users/overtrue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/overtrue/subscriptions","organizations_url":"https://api.github.com/users/overtrue/orgs","repos_url":"https://api.github.com/users/overtrue/repos","events_url":"https://api.github.com/users/overtrue/events{/privacy}","received_events_url":"https://api.github.com/users/overtrue/received_events","type":"User","site_admin":false},"repo":{"id":47127359,"name":"socialite","full_name":"overtrue/socialite","owner":{"login":"overtrue","id":1472352,"avatar_url":"https://avatars.githubusercontent.com/u/1472352?v=3","gravatar_id":"","url":"https://api.github.com/users/overtrue","html_url":"https://github.com/overtrue","followers_url":"https://api.github.com/users/overtrue/followers","following_url":"https://api.github.com/users/overtrue/following{/other_user}","gists_url":"https://api.github.com/users/overtrue/gists{/gist_id}","starred_url":"https://api.github.com/users/overtrue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/overtrue/subscriptions","organizations_url":"https://api.github.com/users/overtrue/orgs","repos_url":"https://api.github.com/users/overtrue/repos","events_url":"https://api.github.com/users/overtrue/events{/privacy}","received_events_url":"https://api.github.com/users/overtrue/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/overtrue/socialite","description":":octocat: Socialite is an OAuth2 Authentication tool. It is inspired by laravel/socialite, you can easily use it without Laravel.","fork":false,"url":"https://api.github.com/repos/overtrue/socialite","forks_url":"https://api.github.com/repos/overtrue/socialite/forks","keys_url":"https://api.github.com/repos/overtrue/socialite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/overtrue/socialite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/overtrue/socialite/teams","hooks_url":"https://api.github.com/repos/overtrue/socialite/hooks","issue_events_url":"https://api.github.com/repos/overtrue/socialite/issues/events{/number}","events_url":"https://api.github.com/repos/overtrue/socialite/events","assignees_url":"https://api.github.com/repos/overtrue/socialite/assignees{/user}","branches_url":"https://api.github.com/repos/overtrue/socialite/branches{/branch}","tags_url":"https://api.github.com/repos/overtrue/socialite/tags","blobs_url":"https://api.github.com/repos/overtrue/socialite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/overtrue/socialite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/overtrue/socialite/git/refs{/sha}","trees_url":"https://api.github.com/repos/overtrue/socialite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/overtrue/socialite/statuses/{sha}","languages_url":"https://api.github.com/repos/overtrue/socialite/languages","stargazers_url":"https://api.github.com/repos/overtrue/socialite/stargazers","contributors_url":"https://api.github.com/repos/overtrue/socialite/contributors","subscribers_url":"https://api.github.com/repos/overtrue/socialite/subscribers","subscription_url":"https://api.github.com/repos/overtrue/socialite/subscription","commits_url":"https://api.github.com/repos/overtrue/socialite/commits{/sha}","git_commits_url":"https://api.github.com/repos/overtrue/socialite/git/commits{/sha}","comments_url":"https://api.github.com/repos/overtrue/socialite/comments{/number}","issue_comment_url":"https://api.github.com/repos/overtrue/socialite/issues/comments{/number}","contents_url":"https://api.github.com/repos/overtrue/socialite/contents/{+path}","compare_url":"https://api.github.com/repos/overtrue/socialite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/overtrue/socialite/merges","archive_url":"https://api.github.com/repos/overtrue/socialite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/overtrue/socialite/downloads","issues_url":"https://api.github.com/repos/overtrue/socialite/issues{/number}","pulls_url":"https://api.github.com/repos/overtrue/socialite/pulls{/number}","milestones_url":"https://api.github.com/repos/overtrue/socialite/milestones{/number}","notifications_url":"https://api.github.com/repos/overtrue/socialite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/overtrue/socialite/labels{/name}","releases_url":"https://api.github.com/repos/overtrue/socialite/releases{/id}","deployments_url":"https://api.github.com/repos/overtrue/socialite/deployments","created_at":"2015-11-30T15:21:29Z","updated_at":"2016-12-02T10:10:19Z","pushed_at":"2016-12-03T12:38:17Z","git_url":"git://github.com/overtrue/socialite.git","ssh_url":"git@github.com:overtrue/socialite.git","clone_url":"https://github.com/overtrue/socialite.git","svn_url":"https://github.com/overtrue/socialite","homepage":"","size":97,"stargazers_count":245,"watchers_count":245,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":40,"mirror_url":null,"open_issues_count":1,"forks":40,"open_issues":1,"watchers":245,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/overtrue/socialite/pulls/33"},"html":{"href":"https://github.com/overtrue/socialite/pull/33"},"issue":{"href":"https://api.github.com/repos/overtrue/socialite/issues/33"},"comments":{"href":"https://api.github.com/repos/overtrue/socialite/issues/33/comments"},"review_comments":{"href":"https://api.github.com/repos/overtrue/socialite/pulls/33/comments"},"review_comment":{"href":"https://api.github.com/repos/overtrue/socialite/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/overtrue/socialite/pulls/33/commits"},"statuses":{"href":"https://api.github.com/repos/overtrue/socialite/statuses/ac6d2de2eaed366749a44a37a4c3328ead46addd"}}}}
{"actor":{"display_login":"overtrue"}}