Getting someone's last picture on behalf of the server - php

Hi guys I understand how to retrieve the ACCESS TOKEN by requesting the permission to access a client's instagram but I'm trying to avoid exactly that.
I need to be able to get someone's last picture without requesting to authenticate on instagram to the client.
There has to be a way with the api to fetch that picture while using OUR instagram account and not the client's instagram is there not?
I don't want to have to hard code a connection and html scraping!
Please enlighten me and sorry for my bad english!
TL;DR: I want to use my client id, client secret or username/password of my instagram account to view another user on instagram's picture!

You can use your access_token to access other user's instagram photo feed API. As long as that user is not private. You cannot use client_id for accessing any user information, you have to authenticate and use access_token. This API call will work for, just replace the user_id you want to access and use your access_token.
https://api.instagram.com/v1/users/USER_ID/media/recent/?access_token=ACCESS-TOKEN

Related

Get user infos from facebook Profile URL

Good morning all,
I must create a site in PHP where we enter the url of the facebook profile, and then it must retrieve some information from the profile:
The profile picture
The name
If the profile and verify
I wish I could do it without this connection.
What to give me a clue?
(I succeeded with tiktok, instagram, etc.) but with facebook it's been a while that I'm looking for the solution
This is not possible for 2 reasons:
Scraping is not allowed on Facebook, you must use the API for accessing any data
Any user data is unavailable with the API, unless the user authorizes your App to access his data
The correct way to implement verification is to implement login with the Graph API and let the user authorize your App. Btw, this still does not mean you can verify his profile url, because you will not get the real URL, not even with authorization.

get offline access_token from instagram api to get users images

Hi is this possible to get access_token in instagram api without login.
I am using server side script that will receive a user name of instagram like "snoopdog" and then my script will get photos of snoopdog from instagram api. but when i am trying to generate access_token it is asking me to login on instagram.
i am using this url to get photos.
https://api.instagram.com/v1/users/1574083/media/recent?access_token=3160711211.5b9e1e6.3b523f746c7c487f8f63743f15e16180
But if i want to generate access_token every time i need to login ?
is there any other way to get offline access token ?
To get access token, you need to login and give permission to your client.

Is it possible to register and log in my users with the Soundcloud API as opposed to just connecting to it?

Basically, I'd like my users to be able to register and log into my site using their Soundcloud accounts (much like Google or Facebook).
But I'm following the login flow from their docs (http://developers.soundcloud.com/docs#authentication), and I understand how to redirect them to the Soundcloud connect screen to authorize my app. And from that, I get a code that I can exchange for an access token. But after that the docs state this:
You should now store the access token in a database. Associate it with
the user it belongs to and use it from now on instead of sending the
user through the authorization flow.
So they're assuming that I already have registered users who then connect to Soundcloud through some other function of my app. But what I want, is for them to be able to create their account from their Soundcloud user info. I think this is initally possible, but when they return to log in again, I need that access token to identify them. But I can't get that access token without sending them through the auth flow again.
I'm guessing what I want to do can't be done, but it's also possible I'm overlooking something. Any help would be appreciated!
I've done this with IMGUR OAuth2 API. After you get the access token, make a new request to their /me endpoint. This way, you'll have the SoundCloud id for that particular user. Now you can check if you already saved this user in your database. If you have, just save the new token to make sure this user has granted your app access to their SoundCloud. I'm not sure if I were clear enough. Let me know if you need any further help .

The correct way to parse facebook feed

I would like to parse one newest feed from one page by PHP.
As I readed, FB rejected curl/fopen and another ways to parse some data.
Instead of this i should use FB API, ok i'll take PHP SDK.
$info = json_decode(file_get_contents('https://graph.facebook.com/cocacola/feed?access_token={some_access_token}'));
Fine, it return me feeds from cocacola page, but it require valid access token.
To get access token user should at least once authorize my app, right?
Reuire autorize from user is not the best idea in this website, so maybe someone know the better way to get just one (newest) feed?
All you need to access the feed of a public page is an application access token for your application, you don't need a user's access token. If you don't have an application you must first set one up at http://developers.facebook.com/apps.
Once you have an app set up on Facebook, you can get an application access token here (replace your app ID and secret ID with the values found on the Facebook app page):
https://graph.facebook.com/oauth/access_token?client_id=<YOUR_APP_ID>&client_secret=<YOUR_APP_SECRET>&grant_type=client_credentials
You can use this in your call to the feed page, as per the link in your question.

How to remove/revoke access token from the LinkedIn

I am using LinkedIn API.
I have done all process to retrieve access token.
but never show anywhere to remove/revoke access token from the LinkedIn.
Please Help.!
Once you store the secret in your DB simply delete it and the access will be revoked.
I believe that if you wish for the user to revoke access to your app the user must to go linkedin and do it, much like Facebook.
As confirmed here: http://developer.linkedin.com/forum/how-really-revoke-apps-oauth-access-token linkedin does not have a programmable API for what you wanna do.
But before you remove it from DB you can invalidate the token which is like an extra step to take by cURLing https://api.linkedin.com/uas/oauth/invalidateToken with your token I believe.
Edit
As #Paul corrects, it is actually quite important to invalidate the tokens with LinkedIn. So doing that and then removing from DB is, as he says, the correct way.

Categories