Is there a way to use Google Photos API without requiring authentication through user prompt? - google-photos

I have some previous experience with the youtube and youtube analytics api where there was an option to use https://developers.google.com/oauthplayground/ to essentially create an offline situation for your own user account api access. By creating the key in the developer console you could add that to a custom oAuth credentials. The user account you were logged into would then generate the access token and refresh token needed. I do not see Google Photos API listed as an option here. I would prefer not to create a website just to get a prompt once (myself).
Any help would be greatly appreciated.

If you are specifically after a token to make your own requests to the API, you can still use the OAuth 2.0 playground. You can enter your own scope in the tool under step 1, just below the list of scopes on the left side. (The text box is labelled "Input your own scopes".)
Here you can manually enter a scope that's listed on the "Authentication and authorization scopes" page in the Google Photos Library API developer documentation.
In step 2, you can access a refresh and access tokens and construct your own request in step 3. Note that you won't be able to List possible operations for this API.
Note that you can also specify your own OAuth client ID and client secret from your own Google developers project. You can find this under the "settings" icon on the right, under "Use your own OAuth credentials". Otherwise, tokens are automatically revoked by the playground after a certain amount of time.
However - If you just want to explore the API through the playground, you can use the version that's embedded in the reference documentation. You can find it on each page for a method, for example mediaItems.list. This version includes support for all API methods and makes it easy to construct correct API requests.

Related

How can I get the code from Server side using Instagram Basic Display API?

I am new to Instagram Basic Display API. All I need is to get the recent media published on my Instagram account. I have followed all the steps mentioned here until step 4. In step 4 when I am accessing the authorize URL it is asking me to log in to my test user instagram account first and then displaying the authorized window. Just imagine this from a user perspective. If a user is clicking on a button and if it is asking for entering the credentials of my account it seems to be like exposing my account details publicly.
Once I click on the authorize button it is redirecting to my redirect_uri and I can get the code.
How can I implement the same from the server-side? There will be no user interaction for the project I am working on. It should happen from the backend itself. I am using Django as the backend server. Please help me with this.
If this is just for your own project and your own Instagram account you can generate access token like it's described here: https://developers.facebook.com/docs/instagram-basic-display-api/overview/#user-token-generator
You don't need the authorization window in that case. On your server just write a code that will send the request to Basic Display API with token created via Token Generator.

Migrating existing Login flow using Instagram Legacy API to the new Instagram Basic graph API

Our application (kind-of got legacy) has been using IG API to authorize users (by using the uid attribute returned from IG's callback API response) and we have left email as an optional param (safe to assume that there are many users in the application database without email IDs persisted)
With new Instagram Basic Display API (advised), it's mentioned to use Facebook Login for authentication purpose. But I am facing a major problem of identifying existing users now (since the uid will be different).
Also I have a doubt on what will have happen for users having instagram account without linking their Facebook account to it?
I could not find a proper explanation or a documentation for seamless migration for my situation.
Please help with sharing the right resource or guidance to achieve the same.

Generate page access token facebook app

I'm trying to create a Messenger bot.
I need to generate a page access token to use it through my app.
However, when I try to generate it, I had the following error
Warning
Platform Access Disabled: Access temporarily disabled due to changes to the Facebook Platform
I have looked for it on Google and it seems that Facebook has blocked temporarily access to their platform as they are making modifications...
Is there another way to generate a token?
I'm able to generate a token for the Graph API explorer. Can I use that one through my app?
Thanks.
You can use your app token in graph api explorer. Please
Select your Apps and select which token that you need select token.
On March 26 2018, Facebook temporarily paused app review, meaning you cannot create new app/page tokens with specific permissions. According to Facebook:
We made the following changes:
Pause app review: We paused app review last week while we implement new changes to our platform.
Access to user friends requires Login Review: We are treating user_friends as an extended permission that requires Login Review.
source

How to read Facebook Insights for a Native/Desktop app programmatically

Unfortunately I'm struggling to understand the documentation provided by Facebook.
This is the scenario:
- Some of my iPhone Apps are also registered as Native/Desktop Apps on Facebook in order to support the Facebook Audience Network.
- I'm building a tool in python which will retrieve data from the reporting API in order to run some automated analysis on specific metrics (request, impressions and so on).
The question is: how do I retrieve this data?
The documentation for the reporting API is here: Reporting API
However I'm struggling with the access token.
It says that I could use the specific App Token available here: App Tokens
However by using such token, I get an error saying that app tokens can't be used for Desktop/Native Ads.
What is the correct way to do it then? Here is where I struggle to understand Facebook Documentation.
My guess is that I should use a User Access Token instead, generated for a user that is also the admin of the App for which I want to retrieve the insights.
What really freaks me out is that apparently, this can't be done with normal HTTP calls only but it requires instead to go through the Facebook Login Dialog. I also need to create another Facebook (web) app because there is no way to get a simple "User Object"... Everything needs to start and go through a registered Facebook App. And there's no way to go through these steps by using backend code only.
So... to recap... in order to read the Insights for a Native/Desktop Facebook App (APP_A), I have to:
- Create a new Web Facebook App (APP_B)
- Create a web interface somewhere for APP_B) which will trigger the Facebook Login Dialog and request the read_insights permission.
- Login through this web interface and generate a User Access Token
- Put this User Access Token in my backend code and run the scripts that retrieve the data provided by the Reporting API for APP_B
Really... to me... it doesn't make any sense to create a new Facebook App in order to access the data of another Facebook App.
Isn't there another better, simpler, quicker, cleaner way to achieve the same final result?

GAE Glass mirror creating multiple oauth signins per user

I've created a Glass app in Python. I began with the mirror quickstart for Python and have my app running fine except some users are getting multiple notifications. I only have one row per user in my Credentials table, however when I go and look at my own Authorized Access on my account I see that I have my Glass project listed 8 separate times.
Can anyone tell me how to check and see if the user has previously granted access to my app when they sign in and if so then skip creating a new token.
You can use the user's ID to prevent storing more than one credential for each user.
When you complete the OAuth flow, you'll receive an ID token along with the access and refresh tokens. If you decode this token, you'll see something like this:
{
"iss":"accounts.google.com",
"at_hash":"HK6E_P6Dh8Y93mRNtsDB1Q",
"email_verified":"true",
"sub":"10769150350006150715113082367",
"azp":"1234987819200.apps.googleusercontent.com",
"email":"jsmith#example.com",
"aud":"1234987819200.apps.googleusercontent.com",
"iat":1353601026,
"exp":1353604926
}
The sub key is the one you're interested in. Use this value to uniquely identify your user. If you see a user authenticate with a user ID that you already know, replace the old value.
If you update your question to include the code you're using for your OAuth flow, we can provide more specific advice. Or, you can learn more about this from Google's OAuth documentation.