4

I'm new to flutter and attempting to add firebase_auth GoogleSignIn to my app. I've followed the instructions of about 5 samples I've found online but keep getting the error when I run the app:

E/GraphResponse( 8321): {HttpStatus: 404, errorCode: 803, subErrorCode: -1, errorType: OAuthException, errorMessage: (#803) Cannot query users by their username (CHANGE-ME)}

I've posted the code for my app here for review: git@github.com:naustin/servicereport_autherror.git

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
  • Looks like https://stackoverflow.com/questions/30886468/facebook-cannot-query-users-by-their-username-solution, https://github.com/criso/fbgraph/issues/98, https://stackoverflow.com/questions/49643821/can-i-get-facebook-id-of-any-user-through-profile-url-or-username – Günter Zöchbauer Feb 23 '19 at 11:31

2 Answers2

0

Based from the error thrown, username can't be used in the query. I've checked the code snippets from the GitHub repository that you've shared and it looks like you're using requestMask on your query.

final http.Response response = await http.get(
  'https://people.googleapis.com/v1/people/me/connections'
      '?requestMask.includeField=person.names',
  headers: await _currentUser.authHeaders,
);

Checking the documentation, requestMask has been deprecated. It's recommended to use personFields instead.

Omatt
  • 8,564
  • 2
  • 42
  • 144
  • But this doesn't solve the problem. The problem is the URL: `'https://people.googleapis.com/v1/people/me/connections' '?requestMask.includeField=person.names'` should be `"https://people.googleapis.com/v1/people/me/connections?requestMask.includeField=${person.names}"` – Chris Pi May 18 '22 at 18:33
  • @ChrisPi this is a query that returns people.connections.list - `person.names` is the field restriction. – Omatt May 19 '22 at 00:29
  • So? Is the request legit? – Chris Pi May 19 '22 at 00:32
0

Referring to the Code from user @Omatt the problem is, that the server gets the wrong field to search. Dots are not allowed, therefore the server just gets person in the requestMask:

'https://people.googleapis.com/v1/people/me/connections?requestMask.includeField=person.names'

Should be written with String Interpolation:

"https://people.googleapis.com/v1/people/me/connections?requestMask.includeField=${person.names}"
Chris Pi
  • 536
  • 1
  • 5
  • 21