I have error when implement Gmail API for Android. My Scopes:
private static final String[] SCOPES = { GmailScopes.GMAIL_LABELS, GmailScopes.GMAIL_COMPOSE,
GmailScopes.GMAIL_INSERT, GmailScopes.GMAIL_MODIFY, GmailScopes.GMAIL_READONLY, GmailScopes.MAIL_GOOGLE_COM };
I can to get messages Id:
Log.i("messages.get(0)", messages.get(0).toPrettyString());
In Android Monitor:
I/messages.get(0): {"id": "1588ae7e991a62f2","threadId" : "1588ae7e991a62f2"}
But when I try to get certain message:
getGmailMessage(mService, user, "1588ae7e991a62f2");
public static Message getGmailMessage(Gmail service, String userId, String messageId) throws IOException {
Message message = service.users().messages().get(userId, messageId).execute();
System.out.println("Message snippet: " + message.getSnippet());
System.out.println("Message getHeaders: " + message.getPayload().getHeaders().get(0));
System.out.println("Message toPrettyString: " + message.getPayload().toPrettyString());
return message;
}
I get an error:
The following error occurred: 403 Forbidden { "code" : 403, "errors" : [ { "domain" : "global", "message" : "Metadata scope doesn't allow format FULL", "reason" : "forbidden" } ], "message" : "Metadata scope doesn't allow format FULL" }
When I run my code in a new project, everything works. Why?