Quantcast
Channel: User Simon_Weaver - Stack Overflow
Viewing all articles
Browse latest Browse all 116

Answer by Simon_Weaver for How to display messages as list in gmail api?

$
0
0

For a newly created OAuth token - try waiting!

I had a weird experience just now.

I modified the example that shows labels to search messages but was getting an error:

var messages = await gapi.client.gmail.users.messages.list({'userId': 'me','q': 'from:someone@example.com'});

API keys are not supported by this API. Expected OAuth2 access tokenor other authentication credentials that assert a principal. Seehttps://cloud.google.com/docs/authentication"

OK, so labels works with just an API key and messages doesn't.

I tried removing the q parameter to match the example above and suddenly it worked. So then I went off to try and figure out what that might mean and didn't get anywhere.

Then I added it back again and it worked right away!

So I can only conclude that newly created credentials may not be completely initialized.

And in fact they say as much:

Note: It may take 5 minutes to a few hours for settings to take effect


Viewing all articles
Browse latest Browse all 116

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>