When viewing the Authorizations table at /user/%user/oauth/authorizations, there are no tokens listed.

Steps to Reproduce
1. Create a new User
2. Go to /user/%user/oauth/consumer
3. Add a Consumer
4. Edit the Consumer at /user/%user/oauth/consumer
5. Click "Add Authorization"
6. Check Authorized and the appropriate Permissions
7. Click Save
8. Click "OAuth Authorizations" (/user/%user/oauth/authorizations)

Expected Result
The new Authorization is listed in a table here.

Observed Result
The table is empty.

The problem is with the oauth_common_token.type field. This tinyint field is used to track the type of token. There are two types: Request and Access. The Authorizations table is looking for Access tokens, but the Add Authorization form at /oauth/%user/oauth/consumer/%consumer/authorizations-add only adds Request tokens.

The DrupalOAuthToken object sets its type value to OAUTH_COMMON_TOKEN_TYPE_REQUEST (oauth/includes/DrupalOAuthToken.inc:6) and the submit handler for the Add Authorizations form (oauth_common_form_authorization_submit), does not change that value (oauth/oauth_common.authorizations.inc:210) before it is written (line 221)

This also prevents the token from being loaded by DrupalOAuthServer when authenticating requests from clients.

Comments

ShadowMonster’s picture

I just get same problem. Do not know if that correct but I just add:

$token->type = OAUTH_COMMON_TOKEN_TYPE_ACCESS;

in line 220 of file oauth_common.authorizations.inc just before

$token->authorized = $values['authorized'];

In my case maybe problem is with PostreSQL DB.

ShadowMonster’s picture

Forgot to write i made that in 3.x-dev

elliotttf’s picture

Version: 7.x-3.1 » 7.x-3.x-dev
Status: Active » Needs review
StatusFileSize
new4.23 KB

I came across this same issue and a few other minor admin issues. Here's a patch that fixed it for me (against 7.x-3.x).

pcambra’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Just tested this and could reproduce the issue, the patch fixes it.