public function auth() { $linkedIn = new Happyr\LinkedIn\LinkedIn(LI_CLIENT_ID, LI_SECRET_KEY); if ($linkedIn->isAuthenticated()) { $access_token = $linkedIn->getAccessToken(); $user = $linkedIn->get('v1/people/~:(id)'); $user_account = array('user_id' => $this->user->id, 'account_id' => $user['id'], 'type' => 'linkedin', 'access_token' => $access_token->getToken()); $this->load->model('user_account_model'); if ($this->user_account_model->save($user_account)) { redirect(base_url() . "main/myaccount/linkedin"); } } exit("Something went wrong."); }