Example #1
0
 public function linkAccountGet()
 {
     #finishes authentication with access code and user id
     list($accessToken, $userId) = $this->getWebAuth()->finish($_GET);
     #generates a client object which we can grab information with by calling getAccountInfo()
     $client = new dbx\Client($accessToken, "PHP");
     $accountInfo = $client->getAccountInfo();
     #input access information to mysql table.
     $table = Api::updateOrCreate(['user_id' => Auth::id(), 'service' => 1, 'service_email' => $accountInfo['email'], 'service_id' => $userId], ['service_accessToken' => $accessToken]);
     $table->save();
     $updatetable = new apiController();
     $updatetable->updateAccounts();
     return redirect('/');
 }
 public function linkAccountGet()
 {
     $client = $this->authInfo['client'];
     $service = $this->authInfo['service'];
     $client->authenticate($_GET['code']);
     $token = $client->getAccessToken();
     $refresh = $client->getRefreshToken();
     $permissionId = $service->about->get()->getUser()->getpermissionId();
     $email = $service->about->get()->getUser()->getemailAddress();
     $table = Api::updateOrCreate(['user_id' => Auth::id(), 'service' => 2, 'service_email' => $email, 'service_id' => $permissionId], ['service_accessToken' => $token]);
     $table->save();
     $updatetable = new apiController();
     $updatetable->updateAccounts();
     return redirect('/');
 }
Example #3
0
 public function onUserLogin($event)
 {
     $updatetable = new apiController();
     $updatetable->updateAccounts();
 }