Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oAuth login error: Object of class MongoDate could not be converted to int #15

Closed
RoboSparrow opened this issue Aug 12, 2015 · 4 comments
Assignees
Milestone

Comments

@RoboSparrow
Copy link
Member

This occurs on a fresh install of lxHive, after creating first oAuth client

POST /oauth/authorize?client_id=vDtf04DQwEeupW59Fb6OOutSQj0GiMGXY4hAfYT7&response_type=code&scope=statements%2Fread&redirect_uri=http%3A%2F%2Flxdash.bo%2Fauth%2FoAuth.php

returns

{"error_message":"Object of class MongoDate could not be converted to int"}

access.log

"POST /oauth/authorize?client_id=vDtf04DQwEeupW59Fb6OOutSQj0GiMGXY4hAfYT7&response_type=code&scope=statements%2Fread&redirect_uri=http%3A%2F%2Flxdash.bo%2Fauth%2FoAuth.php HTTP/1.1" 500 724 "http://lxhive.bo/oauth/authorize?client_id=vDtf04DQwEeupW59Fb6OOutSQj0GiMGXY4hAfYT7&response_type=code&scope=statements%2Fread&redirect_uri=http%3A%2F%2Flxdash.bo%2Fauth%2FoAuth.php" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:40.0) Gecko/20100101 Firefox/40.0"

Client console snapshot:

./X oauth:client:create
 // blah..
OAuth client successfully created!
Info:
{
    "clientId": "vDtf04DQwEeupW59Fb6OOutSQj0GiMGXY4hAfYT7",
    "secret": "qqFeuDlVyI3s2GsUVldYnvjRag36NeeUBtZigSkY",
    "description": "lxDash Admin",
    "name": "lxDash",
    "redirectUri": "http:\/\/lxdash.bo\/auth\/oAuth.php",
    "_id": {
        "$id": "55caa4683fab4b8a208b4567"
    }
}
@RoboSparrow
Copy link
Member Author

What puzzles me as well.. there is nothing in the error.log (mode: production)

@RoboSparrow RoboSparrow added this to the 0.9.0 milestone Aug 12, 2015
@RoboSparrow
Copy link
Member Author

Still persisting.

devel branch:
Document/Auth/OAuthToken.php, line 51: $this->getExpiresAt() I am not sure where this method comes from

/Service/Auth/OAuth.php

        $cursor->where('token', $accessToken);
        $accessTokenDocument = $cursor->current();

        if ($accessTokenDocument === null) {
            throw new \Exception('Invalid access token specified.', Resource::STATUS_FORBIDDEN);
        }

        $expiresAt = $accessTokenDocument->getExpiresAt();

$accessTokenDocument is just an assoc array?

@RoboSparrow
Copy link
Member Author

on master > development mode:

Slim Application Error

The application could not run because of the following error:
Details
Type: ErrorException
Code: 8
Message: Object of class MongoDate could not be converted to int
File: /var/www/html/lxHive/src/xAPI/Document/Auth/OAuthToken.php
Line: 51
Trace

#0 /var/www/html/lxHive/src/xAPI/Document/Auth/OAuthToken.php(51): Slim\Slim::handleErrors(8, 'Object of class...', '/var/www/html/l...', 51, Array)
#1 /var/www/html/lxHive/src/xAPI/Document/Auth/AbstractToken.php(85): API\Document\Auth\OAuthToken->getExpired()
#2 /var/www/html/lxHive/src/xAPI/Document/Auth/AbstractToken.php(97): API\Document\Auth\AbstractToken->isExpired()
#3 /var/www/html/lxHive/vendor/sokil/php-mongo/src/Document.php(789): API\Document\Auth\AbstractToken->isValid()
#4 /var/www/html/lxHive/vendor/sokil/php-mongo/src/Document.php(1192): Sokil\Mongo\Document->validate()
#5 /var/www/html/lxHive/src/xAPI/Service/Auth/OAuth.php(111): Sokil\Mongo\Document->save()
#6 /var/www/html/lxHive/src/xAPI/Service/Auth/OAuth.php(312): API\Service\Auth\OAuth->addToken(1439427698, Object(API\Document\User), Object(API\Document\Auth\OAuthClient), Array, 'p76VwNGLUexCnAT...')
#7 /var/www/html/lxHive/src/xAPI/Resource/V10/Oauth/Authorize.php(89): API\Service\Auth\OAuth->authorizePost(Object(Slim\Http\Request))
#8 /var/www/html/lxHive/public/index.php(210): API\Resource\V10\Oauth\Authorize->post()
#9 [internal function]: {closure}('oauth', 'authorize')
#10 /var/www/html/lxHive/vendor/slim/slim/Slim/Route.php(468): call_user_func_array(Object(Closure), Array)
#11 /var/www/html/lxHive/vendor/slim/slim/Slim/Slim.php(1357): Slim\Route->dispatch()
#12 /var/www/html/lxHive/vendor/slim/slim/Slim/Middleware/Flash.php(85): Slim\Slim->call()
#13 /var/www/html/lxHive/vendor/slim/slim/Slim/Middleware/MethodOverride.php(92): Slim\Middleware\Flash->call()
#14 /var/www/html/lxHive/vendor/slim/slim/Slim/Middleware/PrettyExceptions.php(67): Slim\Middleware\MethodOverride->call()
#15 /var/www/html/lxHive/vendor/slim/slim/Slim/Slim.php(1302): Slim\Middleware\PrettyExceptions->call()
#16 /var/www/html/lxHive/public/index.php(244): Slim\Slim->run()
#17 {main}

@sraka1
Copy link
Contributor

sraka1 commented Aug 24, 2015

Cannot replicate on "development", should've been fixed with #13.

@sraka1 sraka1 closed this as completed Aug 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants