/** * Link Account * * @param \IPS\Member $member The member * @param mixed $details Details as they were passed to the exception thrown in authenticate() * @return void */ public static function link( \IPS\Member $member, $details ) { try { $userData = \IPS\Http\Url::external( "https://api.vk.com/method/getProfiles?uid={$details[1]}&access_token={$details[0]}&fields=first_name,last_name,screen_name,bdate,nickname" )->request()->get()->decodeJson(); $userData = $userData['response'][0]; $member->vk_id = $details[1]; $member->vk_token = $details[0]; $member->save(); }catch(\Exception $e) {} }