How do I redirect and pass my Google API data after handling it in my Oauth2callback handler on Google App Engine - python-2.7

My Oauth2Callback handler is able to access the Google API data I want - I want to know the best way to get this data to my other handler so it can use the data I've acquired.
I figure I can add it to the datastore, or also perform redirect with the data. Is there a "best way" of doing this? For a redirect is there a better way than adding it to query string?

I think I found a better way of doing it, I just use the oauth callback to redirect only with no data, and then on the redirect handler I access the API data.

Related

Send HTTP POST request to Segment.io from GCP

I am trying to send HTTPS Post Request from GCP to Segment.io
I want to create a service that will read data from BigQuery table and then send calls directly to Segment.io API (link) from where I'll redirect the data to other destinations, but on the GCP site I'm struggling to find the most optimal way to do it. Cloud Run seems like a good option but I'm wondering if there might be an easier way?
The recommended products to be used for this task can be either Cloud Run or Cloud Functions.
You can either use the Client Libraries or API in order to extract the data from the BigQuery table and use any HTTP request library of your favorite programming language to issue the POST request to the Segment.io API.

setting up django server for receiving callbacks from jira and other apis

how can I start receiving and parsing callback api's responds in further with Django server?
I wanna setup my DRF server to start working with JIRA webhooks, but also it might be useful for other apis such as telegram and etc. In this case I need to provide them my server's url where I would expect new events/data, but atm I don't realise what it means exactly. Where do I need to start digging in?
Not sure about the apis you are talking about but if the api sends some callbacks you'll give them a url, mysite.com/whatever
make your url config like normal
and in your view you can parse the result
def my_callback_view(request):
# assuming it's a POST request
data = request.POST
... do whatever with the data

How to programmatically post like and comment an URL on facebook?

This is confusing. So just to clarify:
REQ #1: To fetch basic stats for a URL, you send GET request to:
http://graph.facebook.com/?ids=http://some.com
(alternatively, FQL can be used to fetch stats for a URL, but that doesn't return the OpenGraph Object)
REQ #2: To fetch comments for a URL, you do a GET:
http://graph.facebook.com/comments/?ids=http://some.com
REQ #3: To fetch likes for a URL, you GET:
http://graph.facebook.com/likes/?ids=http://some.com
But how do you comment on / like a URL programmatically?
I guess, likes can be created using Open Graph API, right?
https://graph.facebook.com/me/og.likes?object=1234
where 1234 is the OpenGraph Object ID of an article (as returned by REQ #1).
But this requires an approval process, the like action has to be approved by Facebook.
Is there a better way to do this? Can I use for example the Graph API for all these things?
My goal:
Currently I'm using the Facebook like button and comments plugin to create likes and comments. But these use the JS SDK, which is huge, and they generate a lot of external requests. I wanna get rid of them and just send an AJAX request to my server, which would then asynchronously talk to Facebook, and it would post the Like / Comment.
Is this possible?
Thanks in advance!
I read through the Facebook docs briefly and I don't believe you can do this other than the way you indicated with authenticating.
You should also take a look at this thread: 'Like' a page using Facebook Graph API
You would need to authorize every single user before he would be able to like something, and you would need to go through a review process on Facebook. And i am pretty sure you would not get the required permissions approved just because you want to get rid of the JavaScript SDK overhead, to be honest.
The Social Plugins are asynchronously, so the overhead for downloading the SDK is irrelevant as it happens in the background and it is non-blocking.
I have an idea, to do this. You can use long term access token, Once you login you receive short term token. After receiving short term token you need to request your long term access token. Save that token in DB or file.
Then you can use Graph Api, to make requests. This will eliminate the need for access requirement every time you request api.
Just use access token you saved before.
Refer this documentation from Facebook for further clarity.
https://developers.facebook.com/docs/facebook-login/access-tokens
Happy Coding!
Atul Jindal

Django Authenticate

Having for instance
http://mywebsite.com?increase_counter=true/
I want to let someone increase counter on my database with a GET request but only when he is authenticated. How can someone be authenticated when coding in something external? eg shell or API.
Should I consider using tokens in GET request or is there an easy way to firstly authenticate someone with a simple request POST or GET and then execute url? EG I want to authenticate myself to django app with a simple shell. How to do it? Maybe another way?
I think your easiest approach is to include some sort of authentication tokens with the GET itself. The problem is that in order for you to be able to use other forms of authentication, you'll need to actually package the data (HTTP Authentication requires an authentication header, traditional authentication requires a cookie header).
If all you want to do is create a simple point-of-entry, then GET parameters are no more complicated than concatenating some strings.

Passing user credentials to a Webservice

We have a website that calls a remote web service. This web service is stateless and needs the credentials every time to get the data back. How do we pass the credentials back and forth? for example a call to
string GetAddress( userid,password)
Is it ok to store the credentials in a session and pass them across https in post ? What is the best way to do this?
According to me it is ok to use session as they will be at server.
another alternative as per me I dont know it will be useful to you or not but use XML to share credential. I have used such application on my previous project so on that basis I am suggesting you to use xml. OR session over ssl will also be good..
Check it if better way exists.