Android Facebook GraphObject is NULL and username is deprecated for versions v2.0

I have changed Old facebook deprecation functions like a GraphUser. In new Request functions sometimes I'm getting values from GraphObject. Sometimes I'm getting following response. I Don't know where I made mistake. please somebody help me to identity my mistake and errors. Thanks in Advance.

{
Response:  responseCode: 400, graphObject: null, error: {HttpStatus: 400, errorCode: 12, 
errorType: OAuthException, errorMessage: (#12) username is deprecated for versions v2.0 and 
higher}, isFromCache:false
}

Whatever I'm able to received Accesstoken. but GraphObject is null.

Upvotes: 0

Views: 473

Answers (2)

I found the issue and I fixed it. version v2.0 API we currently using. In this API, They have deprecated username in GraphObject json response. This username key is not available in that Json. So It gave that error. We have remove username key in permission list before we passed through Request. If we check out the facebook developer site. they have clearly mentioned the deprecation and it's appropriate replacements. Thanks all.

Upvotes: 0

Tobi
Tobi

Reputation: 31479

You're trying to request the username field, but you can't, because apparantly your app is a Graph API v2.1 app. Since v2.0 it's no longer possible to request the username field. Basically, it's all in the error message already.

Upvotes: 1

Related Questions