my angular 2 app uses facebook login to get username, email and profile picture. I am able to get username and email But url for profile picture provided by facebook api does not work.
Here is the flow of the app
- user logs in to facebook from my app with permission to name,email and profile picture
- After login the app requests for name,email and profile picture using Facebook api
- app gets response from facebook api containing all the requested data example below
response : {
email:"[email protected]"
id:"992219737612453"
name:"user name"
picture: {
data:height:50
is_silhouette:false
url:"https://lookaside.facebook.com/platform/profilepic/?
asid=992219737612453&height=50&width=50&ext=1527274398
&hash=AeQwwpehQqNhgVxr"
width:50
}
}
But the problem is that url given in the above response for picture does not work and gives error 429. But the same url starts working when it is accessed using vpn. Anyone please figure out what the problem is and how to solve it.
Note: 429 error stands for too many requests but at facebook developer dashboard page for this app it says your app has not reached level for rate limiting.
UPDATE: URL is being blocked when it is accessed using specific ISP that belongs to CHINA. But the problem is my most users use that Internet service provider.
2
Answers
As described in question its a problem of Internet service provider which works/origin is from CHINA. So, you will need neutral ISP from any region or the of the region on which url works.
The only solution to this problem is that you should setup a server (express best option for angular 2/4 ) hosted on different ISP. And the server gets image from that url and returns it back to the client.
Wrong Architecture:
Client ==================================================> Server containing Image
Client <===============429Error(Due to Different ISP)<=========== Server containing Image
Right Architecture:
Angular ===================> Express ==========> Server Containing Image
Angular <=================== Express <========== Server Containing Image
If this is working over a VPN, it sounds like a permissions issue. What permissions could the VPN allow that the local machine or server you are running from does not have?