raz3r
raz3r

Reputation: 3131

Scope not allowed when calling API Method from API Explorer

I have a strange behaviour in Google App Engine. I am developing with Eclipse and Java, specifically with Google Cloud Endpoints. I created a sample API with the following settings. Actually I was working with many others scopes but I decided to try with only one to track down the error.

@Api(
    name = "adminmanagement", 
    version = "v1",
    scopes = {AdminManagement.EMAIL_SCOPE},
    clientIds = {AdminManagement.WEB_CLIENT_ID, AdminManagement.API_EXPLORER_CLIENT_ID}
)

public static final String EMAIL_SCOPE = "https://www.googleapis.com/auth/userinfo.email";
public static final String WEB_CLIENT_ID = "***.apps.googleusercontent.com";
public static final String API_EXPLORER_CLIENT_ID = com.google.api.server.spi.Constant.API_EXPLORER_CLIENT_ID;

In the API Method as usual I check if the user object is null.

if (user == null) {
    throw new OAuthRequestException("Unauthorised Access!");
}

This is pretty much straight forward and it always worked. However this time it does not. If I try to call the API method through the API Explorer I get the following error:

401 Unauthorized

And through the Eclipse Console I can see the following one:

INFO: getCurrentUser: AccessToken; scope not allowed

The SDK version is 1.9.1 but atm I have another application wich uses Drive API and works. I tryed deleting and creating a new Cloud Console, deleting and creating a new App Engine application but I always get this error. By the way, if I deploy the application on App Engine I get a 500 Internal Error with no specification and NOTHING shows up in the logs. Just the API call with no errors whatsover.

This is driving me crazy, what am I missing?

EDIT: The bug DOES NOT occur in version 1.8.9 and below...

Upvotes: 2

Views: 276

Answers (1)

raz3r
raz3r

Reputation: 3131

The problem magically resolved itself, I haven't changed a thing, however I wasn't the only one with this problem so I supposed Google must have fixed something.

Upvotes: 1

Related Questions