use \OCA\Grauphel\Lib\NoteStorage;
use \OCA\Grauphel\Lib\OAuth;
+use \OCA\Grauphel\Lib\OAuthException;
use \OCA\Grauphel\Lib\Dependencies;
use \OCA\Grauphel\Lib\Response\ErrorResponse;
*/
class ApiController extends Controller
{
- /**
- * constructor of the controller
+ /**
+ * constructor of the controller
*
- * @param string $appName Name of the app
- * @param IRequest $request Instance of the request
- */
- public function __construct($appName, \OCP\IRequest $request, $user)
+ * @param string $appName Name of the app
+ * @param IRequest $request Instance of the request
+ */
+ public function __construct($appName, \OCP\IRequest $request, $user)
{
parent::__construct($appName, $request);
$this->user = $user;
$urlGen = $deps->urlGen;
try {
- $provider = new \OAuthProvider();
+ $provider = OAuth::getProvider();
$oauth->registerHandler($provider)
->registerAccessTokenHandler($provider);
$provider->checkOAuthRequest(
$token = $deps->tokens->load('access', $provider->token);
$username = $token->user;
- } catch (\OAuth_Exception $e) {
+ } catch (OAuthException $e) {
return new ErrorResponse($e->getMessage());
} catch (\OAuthException $e) {
if ($e->getCode() != OAUTH_PARAMETER_ABSENT) {