Handle facebook confirmation popup from rest service - java

I have following requirement,Through rest service,I need to fetch feed from facebook and store in db.I have to do this for every one hour.
I have created App in Graph_Api,when i want to communicate with graph api for the first time, below mentioned pop-up is coming. As i told you, i am doing from backend so no manual interaction to click on Continue as DevSample. Is there any way to get out of this through rest? please suggest
Any help would be appreciated.

Related

YouTube Data API v3 quota exceeded on the first upload

I am trying to develop a desktop application in Java for uploading videos. I create a new Google account, create project on developer console and create credentials (ClientID and ClientSecret). After creating all of these, i do authorization (as in java examples), the application opens browser window for me to allow the application to manage the channel, and everything works fine.
But when i try to upload a video (short video, tried it on other channels before and it uploaded every time), i immediately get quota exceeded response. And in the developer console i can see that quota is actually exceeded (9644 queries already). I must add that this is happening only for the newly registered accounts - the same video uploads without issues using the same app.
Why is this happening? Is there any way I can "register" new account and immediately do upload? If not, how can I do this properly? Thanks
I had a similar problem with the python code that i used (i modified code based on https://developers.google.com/youtube/v3/guides/uploading_a_video). I solved it using the following workflow:
create a (new) google account if you dont have one yet
go to youtube, sign up with the google account and create a channel
go to
https://console.developers.google.com/apis/credentials?pli=1
create a project, pick a name
click on OAuth consent screen, pick external, pick application name
go back to Credentials, create Credentials using OAuthClient ID, pick Web application
pick a name, put into redirect urls: http://localhost:8080/ and https://developers.google.com/oauthplayground and save
go to Dashboard, search YouTube Data API v3 and enable
then go to https://developers.google.com/oauthplayground/
click on the rack wheel on the right, click use your own credentials, copy and past clientID and secret client from https://console.developers.google.com/apis/credentials and close
search for Youtube Data API v3 on the left, and select https://www.googleapis.com/auth/youtube.upload and https://www.googleapis.com/auth/youtube
click authorize APIs, log into your account, agree to all questions asked
Click Exchange authorization code for token
the Request on the right should not give you any errors
go back to https://console.developers.google.com/apis/credentials, when you click on the edit button next to your credentials, you should be able to download your JSON files. put them into the script folder under client_secrets.json
make sure to delete the file python_upload_video.py-oauth2.json from previous trys
when running the code with for example
python upload_video.py --file="input.mp4" --privacyStatus="unlisted"
the browser should open and ask you to log into your account
what i noticed is that:
if you get three errors in three hours it seems to exceed the quota and you cannot continue
the upload works for about 5 videos a day. If you need to upload more and cannot wait the only way is to create a new account and repeat the steps above (as far as I know)
It may be worth investigating further: I guess that your issue has to do with the API issues seen since about three days now. See the answer https://stackoverflow.com/a/55220182/8327971; also Google's known and acknowledged issue: https://issuetracker.google.com/issues/128673552.

compatibility between React.JS and java

I have a question that tapped me. can someone help?
Here is my question:
can react front end be used with java?
If yes How is it possible?
Thank you in advance
Yes it is possible to use react front end and java as back end.
Let us assume you want to build simple school management application with following feature.
In home page we want to show simple three tab student teacher and admin.By clicking over each tab it should show a page containg that partucular user realted data(userName, picture, address).
We will be having simple Mysql database to store user information.
Use React:
To build this I will use express as framework to use React.In React I will be having component HomePage and UserInfo.
When we click any tab on home page we need to fetch data from database.
To call an external api I will use redux and save data in redux store.
Your frontend will be running on express(assume on localhost:3000)
Use Java:
As backend Let us assume we want some manipulation of data so we will use java(use jersey to make rest apis).In java we can make connection to database and fetch data.Using java we will make a post api taking user type which return user data in json format.This json will be stored in redux store.So in new page after clicking I will iterarte through this data and show in page.
Your backend in java will be running on tomcat(assume on localhost:8000)
Yes of course, in fact java and react or any other front-end technologies should not have a problem communicating to each other. You may want to do some readings on Representational state transfer (REST).

How to use YouTube data api without user interaction?

I am currently developing a server side web application which needs to upload a video present on the server to multiple YouTube channel. I have credentials of these accounts and have full access to them. I have read the documentation and in every flow user interaction is required. I want the complete authentication to happen at server side. Is this possible? If yes, how?
Its not possible to do it without a one time user interaction, (which does not need to be part of your app). Service accounts don't work with YouTube API.
What you can do and what I have done in the past is authenticate your code once save the refresh token someplace. Then when you want to access it in your server sided script you use the refresh token to get a new access token and you have access. Drawback is keeping track of the refresh tokens and sometimes they stop working and you have to re-authenticate them again.

Monitor google search in Java

for my master thesis I need to keep track of google searches that the users perform. It should be a web project. At first I want to setup a server (that acts like a proxy) to monitor all actions (search queries) performed by the user.
The server should deliver the google search page. I need to keep track of the input the users make and the corresponding results returned from google as well.
My questen is now.. How should I start?
I am not really sure which webserver to use. Should I use tomcat / jetty / or something else?
What about Java Server Faces or Servlets? I worked with JSF long time ago but I am not sure whether its a good decision to use it.
The server should deliver the google search page. Here is my idea: The user connects to my server. The server "reads" the google page and returns it (the source code) to the user. I think of using a listener on the default search field to monitor the search queries of the users. But how is it possible to monitor the results returned from google? The google site itself uses JavaScript I guess. So when the user makes some input it is directly sent to google and the results are directly shown on the webpage thus my webserver does not see anything from the connection between the client and the google services.
The main idea is to monitor a search query and the corresponding search results.
I just need some help and ideas to get started. This is just a small part of my thesis. I do not want to start from zero during my editing time thus I want to make sure that I make the right choices before I start.
Thank you in advance... best regards.
You could use netty as a proxy and just filter and log all search queries. But then again why even use java? From what you describe you wan't to play man-in-the-middle and manipulate/log http traffic.
A quick google search came up with this for python: https://code.google.com/p/proxpy/
Edit: and similar in java https://github.com/adamfisk/LittleProxy

How to install an app on a user's page automatically?

I am writing an app where I am supposed to make a user to add my app to his page.
Right now if I want a user to make him add the app to his account I am simply redirecting the user to apps.facebook.com/myfunnyapp. From there on, facebook will guide him add the app to his account.
But I am supposed to make him add the app to his page.
Any ideas? Thank you all in advance.
Did you try this url:
http://www.facebook.com/add.php?api_key=<your_api_key>&pages
It will add your app to his fanpage automatically.
I found the answer. This post helped me
redirect on facebook app install
We need to post a request to https://api.facebook.com/method/admin.setAppProperties?access_token=App_Token&properties={'post_authorize_redirect_url':'http://myhost.com/Test/callback.jsp?'}
Your app access token can be found here https://developers.facebook.com/tools/access_token/
Note: you have to use a app_token instead a user_token.
But what I need to know is will this app_token change every time or not?
Any ideas gurus?

Categories