{"action":"created","comment":{"url":"https://api.github.com/repos/Darkmira/dm-portal/pulls/comments/204128202","pull_request_review_id":139160085,"id":204128202,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNDEyODIwMg==","diff_hunk":"@@ -0,0 +1,109 @@\n+<?php\n+\n+namespace AppBundle\\Services;\n+\n+use Happyr\\LinkedIn\\LinkedIn;\n+use Symfony\\Component\\Config\\Definition\\Exception\\Exception;\n+use Symfony\\Component\\HttpFoundation\\Response;\n+use Symfony\\Component\\HttpFoundation\\Session\\Session;\n+use Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface;\n+use Symfony\\Component\\Routing\\Router;\n+\n+class LinkedinFunctions\n+{\n+    private $linkedinApiId;\n+    private $linkedinApiSecret;\n+    private $dmPortalProd;\n+    private $redirectUrl;\n+    private $session;\n+    private $router;\n+\n+    const VISIBILITY = 'anyone';\n+\n+    /**\n+     * LinkedinFunctions constructor.\n+     * @param $linkedinApiId\n+     * @param $linkedinApiSecret\n+     * @param $redirectUrl\n+     * @param $router\n+     * @param $session\n+     * @param $dmPortalProd\n+     */\n+    public function __construct($linkedinApiId, $linkedinApiSecret, $redirectUrl,Router $router , Session $session, $dmPortalProd)\n+    {\n+        $this->linkedinApiId = $linkedinApiId;\n+        $this->linkedinApiSecret = $linkedinApiSecret;\n+        $this->redirectUrl = $redirectUrl;\n+        $this->session = $session;\n+        $this->router = $router;\n+        $this->dmPortalProd = $dmPortalProd;\n+\n+        $this->linkdin = new LinkedIn($this->linkedinApiId, $this->linkedinApiSecret);\n+    }\n+\n+    /**\n+     * @return string\n+     */\n+    public function getLinkedinLogin()\n+    {\n+        if (!$this->linkdin->isAuthenticated()) {\n+           $callback = $this->router->generate($this->redirectUrl, array(), UrlGeneratorInterface::ABSOLUTE_URL);\n+           return $this->linkdin->getLoginUrl(['redirect_uri' => $callback]);\n+        } elseif ($this->linkdin->getError()) {\n+            echo \"L'utilisateur a annulé le login.\";\n+        }\n+    }\n+\n+    /**\n+     * @return mixed\n+     */\n+    public function LinkedinCallback()\n+    {\n+        try {\n+            $accessToken = $this->linkdin->getAccessToken();\n+        } catch (Exception $e) {\n+            echo $e->getMessage();\n+            exit;\n+        }\n+\n+        if (!$accessToken) {\n+            $response = new Response();\n+            if ($this->linkdin->hasError()) {\n+                $response->setStatusCode(Response::HTTP_UNAUTHORIZED);\n+                echo \"Error: \" . $this->linkdin->getError() . \"\\n\";","path":"src/AppBundle/Services/LinkedinFunctions.php","position":null,"original_position":73,"commit_id":"376c2cada4da17643abf2c6a9408b348969de7c6","original_commit_id":"0642e5c5f00142fcc6b926d4a6d2a01770563b95","user":{"login":"cgrandval","id":903317,"node_id":"MDQ6VXNlcjkwMzMxNw==","avatar_url":"https://avatars2.githubusercontent.com/u/903317?v=4","gravatar_id":"","url":"https://api.github.com/users/cgrandval","html_url":"https://github.com/cgrandval","followers_url":"https://api.github.com/users/cgrandval/followers","following_url":"https://api.github.com/users/cgrandval/following{/other_user}","gists_url":"https://api.github.com/users/cgrandval/gists{/gist_id}","starred_url":"https://api.github.com/users/cgrandval/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cgrandval/subscriptions","organizations_url":"https://api.github.com/users/cgrandval/orgs","repos_url":"https://api.github.com/users/cgrandval/repos","events_url":"https://api.github.com/users/cgrandval/events{/privacy}","received_events_url":"https://api.github.com/users/cgrandval/received_events","type":"User","site_admin":false},"body":"@behnoushnorouzi you probably meant $this->linkedin?","created_at":"2018-07-20T18:13:45Z","updated_at":"2018-07-20T18:13:45Z","html_url":"https://github.com/Darkmira/dm-portal/pull/20#discussion_r204128202","pull_request_url":"https://api.github.com/repos/Darkmira/dm-portal/pulls/20","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/Darkmira/dm-portal/pulls/comments/204128202"},"html":{"href":"https://github.com/Darkmira/dm-portal/pull/20#discussion_r204128202"},"pull_request":{"href":"https://api.github.com/repos/Darkmira/dm-portal/pulls/20"}},"in_reply_to_id":203975855},"pull_request":{"url":"https://api.github.com/repos/Darkmira/dm-portal/pulls/20","id":202271431,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAyMjcxNDMx","html_url":"https://github.com/Darkmira/dm-portal/pull/20","diff_url":"https://github.com/Darkmira/dm-portal/pull/20.diff","patch_url":"https://github.com/Darkmira/dm-portal/pull/20.patch","issue_url":"https://api.github.com/repos/Darkmira/dm-portal/issues/20","number":20,"state":"open","locked":false,"title":"Post Shares on LinkedIn","user":{"login":"behnoushnorouzi","id":9305884,"node_id":"MDQ6VXNlcjkzMDU4ODQ=","avatar_url":"https://avatars3.githubusercontent.com/u/9305884?v=4","gravatar_id":"","url":"https://api.github.com/users/behnoushnorouzi","html_url":"https://github.com/behnoushnorouzi","followers_url":"https://api.github.com/users/behnoushnorouzi/followers","following_url":"https://api.github.com/users/behnoushnorouzi/following{/other_user}","gists_url":"https://api.github.com/users/behnoushnorouzi/gists{/gist_id}","starred_url":"https://api.github.com/users/behnoushnorouzi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/behnoushnorouzi/subscriptions","organizations_url":"https://api.github.com/users/behnoushnorouzi/orgs","repos_url":"https://api.github.com/users/behnoushnorouzi/repos","events_url":"https://api.github.com/users/behnoushnorouzi/events{/privacy}","received_events_url":"https://api.github.com/users/behnoushnorouzi/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-07-18T14:25:13Z","updated_at":"2018-07-20T18:13:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c288a1d29350f90e1bc3b1913529eb02bd2492be","assignee":{"login":"behnoushnorouzi","id":9305884,"node_id":"MDQ6VXNlcjkzMDU4ODQ=","avatar_url":"https://avatars3.githubusercontent.com/u/9305884?v=4","gravatar_id":"","url":"https://api.github.com/users/behnoushnorouzi","html_url":"https://github.com/behnoushnorouzi","followers_url":"https://api.github.com/users/behnoushnorouzi/followers","following_url":"https://api.github.com/users/behnoushnorouzi/following{/other_user}","gists_url":"https://api.github.com/users/behnoushnorouzi/gists{/gist_id}","starred_url":"https://api.github.com/users/behnoushnorouzi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/behnoushnorouzi/subscriptions","organizations_url":"https://api.github.com/users/behnoushnorouzi/orgs","repos_url":"https://api.github.com/users/behnoushnorouzi/repos","events_url":"https://api.github.com/users/behnoushnorouzi/events{/privacy}","received_events_url":"https://api.github.com/users/behnoushnorouzi/received_events","type":"User","site_admin":false},"assignees":[{"login":"behnoushnorouzi","id":9305884,"node_id":"MDQ6VXNlcjkzMDU4ODQ=","avatar_url":"https://avatars3.githubusercontent.com/u/9305884?v=4","gravatar_id":"","url":"https://api.github.com/users/behnoushnorouzi","html_url":"https://github.com/behnoushnorouzi","followers_url":"https://api.github.com/users/behnoushnorouzi/followers","following_url":"https://api.github.com/users/behnoushnorouzi/following{/other_user}","gists_url":"https://api.github.com/users/behnoushnorouzi/gists{/gist_id}","starred_url":"https://api.github.com/users/behnoushnorouzi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/behnoushnorouzi/subscriptions","organizations_url":"https://api.github.com/users/behnoushnorouzi/orgs","repos_url":"https://api.github.com/users/behnoushnorouzi/repos","events_url":"https://api.github.com/users/behnoushnorouzi/events{/privacy}","received_events_url":"https://api.github.com/users/behnoushnorouzi/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Darkmira/dm-portal/pulls/20/commits","review_comments_url":"https://api.github.com/repos/Darkmira/dm-portal/pulls/20/comments","review_comment_url":"https://api.github.com/repos/Darkmira/dm-portal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Darkmira/dm-portal/issues/20/comments","statuses_url":"https://api.github.com/repos/Darkmira/dm-portal/statuses/376c2cada4da17643abf2c6a9408b348969de7c6","head":{"label":"behnoushnorouzi:feat-api-linkedin","ref":"feat-api-linkedin","sha":"376c2cada4da17643abf2c6a9408b348969de7c6","user":{"login":"behnoushnorouzi","id":9305884,"node_id":"MDQ6VXNlcjkzMDU4ODQ=","avatar_url":"https://avatars3.githubusercontent.com/u/9305884?v=4","gravatar_id":"","url":"https://api.github.com/users/behnoushnorouzi","html_url":"https://github.com/behnoushnorouzi","followers_url":"https://api.github.com/users/behnoushnorouzi/followers","following_url":"https://api.github.com/users/behnoushnorouzi/following{/other_user}","gists_url":"https://api.github.com/users/behnoushnorouzi/gists{/gist_id}","starred_url":"https://api.github.com/users/behnoushnorouzi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/behnoushnorouzi/subscriptions","organizations_url":"https://api.github.com/users/behnoushnorouzi/orgs","repos_url":"https://api.github.com/users/behnoushnorouzi/repos","events_url":"https://api.github.com/users/behnoushnorouzi/events{/privacy}","received_events_url":"https://api.github.com/users/behnoushnorouzi/received_events","type":"User","site_admin":false},"repo":{"id":108523320,"node_id":"MDEwOlJlcG9zaXRvcnkxMDg1MjMzMjA=","name":"dm-portal","full_name":"behnoushnorouzi/dm-portal","owner":{"login":"behnoushnorouzi","id":9305884,"node_id":"MDQ6VXNlcjkzMDU4ODQ=","avatar_url":"https://avatars3.githubusercontent.com/u/9305884?v=4","gravatar_id":"","url":"https://api.github.com/users/behnoushnorouzi","html_url":"https://github.com/behnoushnorouzi","followers_url":"https://api.github.com/users/behnoushnorouzi/followers","following_url":"https://api.github.com/users/behnoushnorouzi/following{/other_user}","gists_url":"https://api.github.com/users/behnoushnorouzi/gists{/gist_id}","starred_url":"https://api.github.com/users/behnoushnorouzi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/behnoushnorouzi/subscriptions","organizations_url":"https://api.github.com/users/behnoushnorouzi/orgs","repos_url":"https://api.github.com/users/behnoushnorouzi/repos","events_url":"https://api.github.com/users/behnoushnorouzi/events{/privacy}","received_events_url":"https://api.github.com/users/behnoushnorouzi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/behnoushnorouzi/dm-portal","description":null,"fork":true,"url":"https://api.github.com/repos/behnoushnorouzi/dm-portal","forks_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/forks","keys_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/teams","hooks_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/hooks","issue_events_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/issues/events{/number}","events_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/events","assignees_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/assignees{/user}","branches_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/branches{/branch}","tags_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/tags","blobs_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/git/refs{/sha}","trees_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/statuses/{sha}","languages_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/languages","stargazers_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/stargazers","contributors_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/contributors","subscribers_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/subscribers","subscription_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/subscription","commits_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/commits{/sha}","git_commits_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/git/commits{/sha}","comments_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/comments{/number}","issue_comment_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/issues/comments{/number}","contents_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/contents/{+path}","compare_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/merges","archive_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/downloads","issues_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/issues{/number}","pulls_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/pulls{/number}","milestones_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/milestones{/number}","notifications_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/labels{/name}","releases_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/releases{/id}","deployments_url":"https://api.github.com/repos/behnoushnorouzi/dm-portal/deployments","created_at":"2017-10-27T08:57:47Z","updated_at":"2017-10-27T08:57:49Z","pushed_at":"2018-07-20T12:52:10Z","git_url":"git://github.com/behnoushnorouzi/dm-portal.git","ssh_url":"git@github.com:behnoushnorouzi/dm-portal.git","clone_url":"https://github.com/behnoushnorouzi/dm-portal.git","svn_url":"https://github.com/behnoushnorouzi/dm-portal","homepage":null,"size":1265,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"Darkmira:develop","ref":"develop","sha":"c248f40218a531492fae36690069b936447db779","user":{"login":"Darkmira","id":3945817,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5NDU4MTc=","avatar_url":"https://avatars2.githubusercontent.com/u/3945817?v=4","gravatar_id":"","url":"https://api.github.com/users/Darkmira","html_url":"https://github.com/Darkmira","followers_url":"https://api.github.com/users/Darkmira/followers","following_url":"https://api.github.com/users/Darkmira/following{/other_user}","gists_url":"https://api.github.com/users/Darkmira/gists{/gist_id}","starred_url":"https://api.github.com/users/Darkmira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Darkmira/subscriptions","organizations_url":"https://api.github.com/users/Darkmira/orgs","repos_url":"https://api.github.com/users/Darkmira/repos","events_url":"https://api.github.com/users/Darkmira/events{/privacy}","received_events_url":"https://api.github.com/users/Darkmira/received_events","type":"Organization","site_admin":false},"repo":{"id":88895299,"node_id":"MDEwOlJlcG9zaXRvcnk4ODg5NTI5OQ==","name":"dm-portal","full_name":"Darkmira/dm-portal","owner":{"login":"Darkmira","id":3945817,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5NDU4MTc=","avatar_url":"https://avatars2.githubusercontent.com/u/3945817?v=4","gravatar_id":"","url":"https://api.github.com/users/Darkmira","html_url":"https://github.com/Darkmira","followers_url":"https://api.github.com/users/Darkmira/followers","following_url":"https://api.github.com/users/Darkmira/following{/other_user}","gists_url":"https://api.github.com/users/Darkmira/gists{/gist_id}","starred_url":"https://api.github.com/users/Darkmira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Darkmira/subscriptions","organizations_url":"https://api.github.com/users/Darkmira/orgs","repos_url":"https://api.github.com/users/Darkmira/repos","events_url":"https://api.github.com/users/Darkmira/events{/privacy}","received_events_url":"https://api.github.com/users/Darkmira/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Darkmira/dm-portal","description":null,"fork":false,"url":"https://api.github.com/repos/Darkmira/dm-portal","forks_url":"https://api.github.com/repos/Darkmira/dm-portal/forks","keys_url":"https://api.github.com/repos/Darkmira/dm-portal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Darkmira/dm-portal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Darkmira/dm-portal/teams","hooks_url":"https://api.github.com/repos/Darkmira/dm-portal/hooks","issue_events_url":"https://api.github.com/repos/Darkmira/dm-portal/issues/events{/number}","events_url":"https://api.github.com/repos/Darkmira/dm-portal/events","assignees_url":"https://api.github.com/repos/Darkmira/dm-portal/assignees{/user}","branches_url":"https://api.github.com/repos/Darkmira/dm-portal/branches{/branch}","tags_url":"https://api.github.com/repos/Darkmira/dm-portal/tags","blobs_url":"https://api.github.com/repos/Darkmira/dm-portal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Darkmira/dm-portal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Darkmira/dm-portal/git/refs{/sha}","trees_url":"https://api.github.com/repos/Darkmira/dm-portal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Darkmira/dm-portal/statuses/{sha}","languages_url":"https://api.github.com/repos/Darkmira/dm-portal/languages","stargazers_url":"https://api.github.com/repos/Darkmira/dm-portal/stargazers","contributors_url":"https://api.github.com/repos/Darkmira/dm-portal/contributors","subscribers_url":"https://api.github.com/repos/Darkmira/dm-portal/subscribers","subscription_url":"https://api.github.com/repos/Darkmira/dm-portal/subscription","commits_url":"https://api.github.com/repos/Darkmira/dm-portal/commits{/sha}","git_commits_url":"https://api.github.com/repos/Darkmira/dm-portal/git/commits{/sha}","comments_url":"https://api.github.com/repos/Darkmira/dm-portal/comments{/number}","issue_comment_url":"https://api.github.com/repos/Darkmira/dm-portal/issues/comments{/number}","contents_url":"https://api.github.com/repos/Darkmira/dm-portal/contents/{+path}","compare_url":"https://api.github.com/repos/Darkmira/dm-portal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Darkmira/dm-portal/merges","archive_url":"https://api.github.com/repos/Darkmira/dm-portal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Darkmira/dm-portal/downloads","issues_url":"https://api.github.com/repos/Darkmira/dm-portal/issues{/number}","pulls_url":"https://api.github.com/repos/Darkmira/dm-portal/pulls{/number}","milestones_url":"https://api.github.com/repos/Darkmira/dm-portal/milestones{/number}","notifications_url":"https://api.github.com/repos/Darkmira/dm-portal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Darkmira/dm-portal/labels{/name}","releases_url":"https://api.github.com/repos/Darkmira/dm-portal/releases{/id}","deployments_url":"https://api.github.com/repos/Darkmira/dm-portal/deployments","created_at":"2017-04-20T18:00:06Z","updated_at":"2018-07-06T13:02:36Z","pushed_at":"2018-07-20T12:52:11Z","git_url":"git://github.com/Darkmira/dm-portal.git","ssh_url":"git@github.com:Darkmira/dm-portal.git","clone_url":"https://github.com/Darkmira/dm-portal.git","svn_url":"https://github.com/Darkmira/dm-portal","homepage":null,"size":1240,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":9,"license":null,"forks":4,"open_issues":9,"watchers":1,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/Darkmira/dm-portal/pulls/20"},"html":{"href":"https://github.com/Darkmira/dm-portal/pull/20"},"issue":{"href":"https://api.github.com/repos/Darkmira/dm-portal/issues/20"},"comments":{"href":"https://api.github.com/repos/Darkmira/dm-portal/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/Darkmira/dm-portal/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/Darkmira/dm-portal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Darkmira/dm-portal/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/Darkmira/dm-portal/statuses/376c2cada4da17643abf2c6a9408b348969de7c6"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"cgrandval"}}