示例#1
0
 public function saveCrestContacts()
 {
     $this->user->contacts = $this->getCurrentContacts();
     $this->user->save();
     //dd($this->user->contacts);
     return redirect('/');
 }
示例#2
0
 public function handleCallback(Request $request)
 {
     if (!($request->has('state') && $request->has('code'))) {
         throw new \Exception('Callback does not provide expected parameters.');
         // TODO: Change to SSOCallbackException
     }
     $this->checkState($request->input('state'));
     // Throws exception if no state match in cache
     // get an access token
     $accessToken = $this->getAccessToken($request->input('code'));
     $charInfo = $this->getCharInfo($accessToken);
     // Find user or create new user.
     //dd($charInfo);
     $user = User::firstOrNew(['id' => $charInfo['CharacterID'], 'name' => $charInfo['CharacterName']]);
     $user->refreshToken = $this->refreshToken;
     $user->save();
     \Cache::put('accessToken:' . $user->id, $accessToken, 15);
     \Auth::login($user);
     return true;
 }