Could not load facebook avatar image [duplicate] - ios

I'm using Facebook graph API by calling https://graph.facebook.com/v2.10/me?access_token=xxxxxxxxxxxxxxxxxx&fields=id,email,name,first_name,last_name,gender,age_range,picture.width(512).height(512),locale,link,timezone,updated_time which returns the json response I was expecting. Something like this:
{
"id": "1234567890987654321",
"email": "xxxxxx\u0040example.com",
"name": "xxxx xxxx",
"first_name": "xxxx",
"last_name": "xxxx",
"gender": "xxxxx",
"age_range": {
"min": 21
},
"picture": {
"data": {
"height": 720,
"is_silhouette": false,
"url": "https://scontent.fna.fbcdn.net/v/t1.0-1/p720x720/xxx.jpg?oh=xxx",
"width": 720
}
},
"locale": "en_US",
"link": "https://www.facebook.com/app_scoped_user_id/1234567890987654321/",
"timezone": xx,
"updated_time": "2017-05-24T14:00:01+0000"
}
However, on calling the url child node of the picture, nothing was returned. I copied the actual link and paste it in Google Chrome browser and DNS_PROBE_FINISHED_NXDOMAIN error is returned.
I checked the image used by the Facebook website, I noticed that it's pointing to a different base url: https://scontent.fjnb2-1.fna.fbcdn.net, while mine is pointing to https://scontent.fna.fbcdn.net. The returned url on graph is missing .fjnb2-1 and it works when I added it.
Is this a known bug on Facebook Graph API?
Is it ok to change the base url to include the missing part?
Any other way to fix this issue without running into another issue later when Facebook decided to change the return url?

This is a known bug which has already been reported by many developers on https://developers.facebook.com/bugs and I believe the Facebook team is working on resolving this.
Edit:
I can confirm that this issue has been resolved by Facebook Dev Team now.

Related

MS Teams Bot sign-in not working, says "This action can't be performed since the app does not exist or has been uninstalled."

I am creating a simple MS Teams messaging bot that requires auth/sign-in.
I am using https://smba.trafficmanager.net/amer/v3/conversations/{conversationId}/activities to send a non-reply bot message to user that includes a hero card with a sign-in button.
The body looks somewhat like this:
{
"type": "message",
"from": {
"id": "abc",
"name": "messaging-bot"
},
"conversation": {
"id": "789",
"name": "test",
"tenantId": "456",
"role": "bot",
"conversationType": "personal"
},
"recipient": {
"id": "123",
"name": "test"
},
"attachments": [
{
"contentType": "application/vnd.microsoft.card.hero",
"content": {
"title": "title goes here",
"subtitle": "subtitle goes here",
"text": "descriptive text goes here",
"buttons": [
{
"type": "signin",
"title": "Click me to sign in",
"value": "<my-signin-url>"
}
]
}
}
]
}
When user receives hero card and clicks sign in button, user gets the following error:
This action can't be performed since the app does not exist or has been uninstalled.
I have added my sign-in domain to valid domains, and uploaded app package to MS Teams, so not sure why I am getting this error.
The app is created through Developer Portal in Ms Teams. For now, we are just creating a simple messaging app that relies on the bot messaging endpoint
May someone help with this?
If you are using Microsoft AD, Please add below in valid domain section of your app manifest:
token.botframework.com
login.microsoftonline.com
Quick update on answer. I found that installing/uninstalling app when sideloading app is a bit buggy. Things worked after I closed my MS Teams client and re-opened it

Microsoft graph not creating embed link for file

While posting request to microsoft graph:
POST 'https://graph.microsoft.com/v1.0/me/drive/root:/017_2018-08-12_18.47.27.jpg:/createLink'
content-type': 'application/json
{
"type": "embed"
}
I am only getting
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#permission",
"#odata.type": "#microsoft.graph.permission",
"id": "5o98ENjWYH2pNK8wO5_d7QHUrdk",
"roles": ["read"],
"shareId": "s!AgDP2w-bgvZL****evpaN2yel",
"link": {
"type": "embed",
"webUrl": "https://onedrive.live.com/embed?resid=4B****U"
But according to documentation, I should also get WebHtml with Iframe link not only webUrl, and this is what I am looking for so I can generate links for photos, and put them on website.
Am I doing something wrong or is there any way around so I can get same embed url that I can generate from manualy clicking in onedrive?
I'm using personal one drive account.
Trying this out on the graph explorer does not work on the v1.0 endpoint for me. However using the beta endpoint does indeed return the webHtml property like as follows
Essentially what you would need to do is change the v1.0 segment in the url to beta.
POST 'https://graph.microsoft.com/beta/me/drive/root:/017_2018-08-12_18.47.27.jpg:/createLink'
content-type': 'application/json
{
"type": "embed"
}
And you should get back something like this
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#permission",
"#odata.type": "#microsoft.graph.permission",
"id": "p6z1ZAtRqKFwqHNVfaa6mPFQIyI",
"roles": [
"read"
],
"shareId": "s!AorKRTkoJljsixZbAANWreQhS7gk",
"expirationDateTime": "0001-01-01T00:00:00Z",
"hasPassword": false,
"link": {
"type": "embed",
"webUrl": "https://onedrive.live.com/embed?resid=EC5826283945CA8A%211430&authkey=!AFsAA1at5CFLuCQ",
"webHtml": "<iframe src=\"https://onedrive.live.com/embed?resid=EC5826283945CA8A%211430&authkey=!AFsAA1at5CFLuCQ\" width=\"98\" height=\"120\" frameborder=\"0\" scrolling=\"no\"></iframe>"
}
}

How Do You Find Someone's Facebook ProfileID?

I am working on an iOS app that loads peoples' profile pictures into an instance of FBProfilePictureView, which has a property of profileID. Is there a way to easily find someone's profileID?
I'm conflicted as to whether this should be in the comments or an answer, but here's how:
You use the Open Graph API found here
A call of http://graph.facebook.com/username returns you a bunch of Json which you can get the id value from.
So, http://graph.facebook.com/facebook returns:
{
"id": "20531316728",
"about": "The Facebook Page celebrates how our friends inspire us, support us, and help us discover the world when we connect.",
"can_post": false,
"category": "Product/service",
"checkins": 348,
"cover": {
"cover_id": "10152513030211729",
"offset_x": 0,
"offset_y": 62,
"source": "https://scontent-b.xx.fbcdn.net/hphotos-xfp1/t31.0-8/q71/s720x720/1553497_10152513030211729_1664524928_o.jpg"
},
"founded": "February 4, 2004",
"has_added_app": false,
"is_community_page": false,
"is_published": true,
"likes": 152791404,
"link": "https://www.facebook.com/facebook",
"mission": "Founded in 2004, Facebook\u2019s mission is to give people the power to share and make the world more open and connected. People use Facebook to stay connected with friends and family, to discover what\u2019s going on in the world, and to share and express what matters to them.",
"name": "Facebook",
"parking": {
"lot": 0,
"street": 0,
"valet": 0
},
"talking_about_count": 2149385,
"username": "facebook",
"website": "http://www.facebook.com",
"were_here_count": 0
}
Why not using the Facebook Tool ? You can have ID and some other information (In JSon format) about people with only replacing their username in the URL.

Not getting user picture with google login

I have made a Google login with OAuth2 and the PHP library which can be found on the documentation site.
The scope which I have used is userinfo. I'm getting all the userinfo except the picture. I accessed both the V1 and V2 links with the access token which I received. The links, if I am not mistaken are, -
https://www.googleapis.com/oauth2/v1/userinfo?access_token=<access-token>
https://www.googleapis.com/oauth2/v2/userinfo?access_token=<access-token>
For both of these, the picture info is missing. I receive the following responses-
{
"id": "<some-id>,
"email": "<correct-email-id>",
"verified_email": true,
"name": "Siddharth Saha",
"given_name": "Siddharth",
"family_name": "Saha",
"link": "<google-plus-link>",
"gender": "male",
"locale": "en"
}
Is there some other way to get the picture? Is there a link to the user picture (like in facebook authentication).
From comment: But do you really have a photo on your profile? I think that the "picture" attribute is included only if you have a photo. I follow your "link" and not photo there.

Google Contacts API not showing emails, nor max results

I'm using the Google Contacts API to get back formatted JSON, hopefully containing ALL of a user's contacts' email addresses. I use this information to search my database for the user's friends.
Neither of these results occur.
Here's the URI that's called (broken up by paramater for slightly better readability:
http://www-opensocial.googleusercontent.com/api/people/#me/#all/?
filterby=emails&max_results=1000
&oauth_consumer_key=XXXXXXX
&oauth_nonce=h7ZEI
&oauth_signature=6U2ywoPRFu8iJdQhjMRk%2FZlf%2FBg%3D
&oauth_signature_method=HMAC-SHA1
&oauth_timestamp=1283979209
&oauth_token=1%2Fwv9OYV4LuffVLv6OqlFJLOtTlBo5sYYQkHbZznlLrNk
&oauth_version=1.0
&orderby=starttime
Here's some truncated and anonymized JSON I have returned.
{
"startIndex": 0,
"totalResults": 615,
"entry": [
{
"id": "XXXXXXXXXXXXXXXXXXX",
"name": {
"formatted": "XXXXX XXXXXX",
"familyName": "XXXXXXX",
"givenName": "XXXXXX"
},
"displayName": "XXXXX XXXXXX"
},
],
"itemsPerPage": 20
}
Any thoughts on what's going wrong here would be great.
Hate to answer my own question so soon, but I was using the wrong initial scope. I was using Google's Open Social feed rather than the Google Contacts feed.

Resources