Gmail Api - Metadata scope does not support 'q' parameter

30 Views Asked by At

I'm trying to use Gmail API for my Flutter app. I'm going to make a list of unread messages that became from someone so as API References, I'm using this code

    var url = Uri.https(EndPoints.gmailBaseUrl, EndPoints.listUnredMessages, {'labelIds': 'UNREAD', 'q' : 'from:Daniel Agbemava'});
// static const String gmailBaseUrl = 'gmail.googleapis.com';
//  static const String listUnredMessages = '/gmail/v1/users/me/messages';
    var request = http.Request('GET', url,);
    request.headers.addAll(authHeaders!);
    http.StreamedResponse response = await request.send();
    Map<String, dynamic> jsonResponse = jsonDecode(await response.stream.bytesToString());
    log(jsonResponse.toString());

as the reference and this issue i removed Google APIs Explorer from premissions and this my new scope

static const List<String> scopes = <String>[
    'https://mail.google.com/',
    'https://www.googleapis.com/auth/gmail.modify',
    'https://www.googleapis.com/auth/gmail.readonly',
  ];

so I went to make a new OAuth and then request the one that I need but I get this response error

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: DetailedApiRequestError(status: 403, message: Metadata scope does not support 'q' parameter)

how to solve it?

0

There are 0 best solutions below