Getting username and profile picture from Facebook iOS 7

This is the simplest way I’ve found to get the user’s profile picture. [[FBRequest requestForMe] startWithCompletionHandler:^(FBRequestConnection *connection, NSDictionary<FBGraphUser> *FBuser, NSError *error) { if (error) { // Handle error } else { NSString *userName = [FBuser name]; NSString *userImageURL = [NSString stringWithFormat:@””, [FBuser objectID]]; } }]; Other query parameters that can be used are: type: small, … Read more

Android share intent for facebook- share text AND link

I just built this code and it’s working for me: private void shareAppLinkViaFacebook(String urlToShare) { try { Intent intent1 = new Intent(); intent1.setClassName(“com.facebook.katana”, “com.facebook.katana.activity.composer.ImplicitShareIntentHandler”); intent1.setAction(“android.intent.action.SEND”); intent1.setType(“text/plain”); intent1.putExtra(“android.intent.extra.TEXT”, urlToShare); startActivity(intent1); } catch (Exception e) { // If we failed (not native FB app installed), try share through SEND String sharerUrl = “” + urlToShare; Intent intent … Read more

Error Invalid Scopes: offline_access, publish_stream, when I try to connect with Facebook API

The permissions offline_access and publish_stream are deprecated, thus cannot be requested anymore. publish_stream can be replaced by publish_actions, offline_access is gone. See

Unable to get access token from Facebook. Got an OAuthException says “Error validating verification code”

I recently dealt with exactly this problem: everything matched, but it failed with the OAuthException. The thing that made it work was to change the redirect uri (in both requests for the flow) from: to I.e., add the trailing slash. And then it worked. Stupid and silly, but there you go.

facebook error ‘Error validating verification code’

There are presently (as of March 2011) undocumented requirements regarding what makes a valid redirect_uri. First, both redirect_uri paramaters to authorize and access_token must match. Apparently Facebook (or rather OAuth2) is using the redirect_uri as a internal key to encode the code returned for the access_token request. It’s kinda clever since it verifies back to … Read more

Facebook SDK returned an error: Cross-site request forgery validation failed. The “state” param from the URL and session do not match

I found that as long as I enabled PHP sessions before generating the login url, and at the top of the script Facebook eventually redirects to, it works just fine on its own without setting a cookie (as per ale500’s answer). This is using the 5.1 version of the sdk. At the top of both … Read more