Getting details of user without login in flask? - flask

I am new to the flask so I need your help on below query-
I created an Flask application and now I want to get the information of user who opened my website? I am not intrested to create any login page or save user information in database. So it will be very simple like this website will be an Opensource and anyone can access.
So could you please let me know the way by which I can get the information of user who opened the website?

As far as I know, there is no way of getting a user's "information" without logging the user in. If you are not interested in creating a database, you can use a log in with google option and then retrieve the "information" of the user using the Google APIs.
It also depends on what information of the user you want. if its simple like the email or first name or gender etc, google login can help with that.
Check these out:
https://realpython.com/flask-google-login/
You would have to provide more info on what you are doing

Related

How to set privacy policy url for a fb app when working on localhost?

I am working on a local application that needs to retrieve data from user's Facebook profile. As long as I can see, by default I can only get name, picture and age range, but I need many others information like education, location, likes and so on. I tried to submit approval for these items, but Facebook won't set my submission because I don't have a Privacy Policy URL added. I don't know what Privacy Policy URL to add because I'm working on localhost.
Please help me figure it out and excuse me if my question is wrong, it's the first time when I work with fb api. Also, if there is another way to retrieve this items, I would be more than happy to hear about it.
Have a look at
https://developers.facebook.com/docs/apps/review/login#do-you-need-review
It's saying that
in order to help you craft your Facebook Login experience, your app's developers will be able to see, and grant, any permission without requiring review by Facebook.
and
Also, if you're the developer of an app and are the only person using it, then your app doesn't need to go through review. Since you're the developer, all app capabilities should be available. You will still need to take your app out of developer mode, but you should be able to do that without going through review.
So, to be able to develop your app and request extended permissions, you don't need to pass your app to review, as long as you test with an app admin/developer/tester.

How to get multiple user images from Twitter (OAuth)?

I have a log in to my site using Twitter. It all works great.
Whilst I can do a call to get the current users details etc and log them in, I'm a bit stumped on how I make calls to get the profile images of users stored in my database; those who may not be using the website at that time?
I am using the monkehTweets Twitter library:
https://github.com/coldfumonkeh/monkehTweets
To get the current user, I sign them in and do this:
application.objMonkehTweet.setFinalAccessDetails(
oauthToken = returnData.token,
oauthTokenSecret = returnData.token_secret,
userAccountName = returnData.screen_name
);
local.userDetails = application.objMonkehTweet.getUserDetails(user_id=returnData.user_id);
As part of the log in process on my website, if a user hasn't used the site before, I store their Twitter ID.
I was hoping to then use this to display their profile images on the posts they make to other users.
What is the best approach to achieve this? With the Facebook API, you can make requests to a URL with the ID...but Twitter doesn't seem to allow this.
I would prefer not to 'store' the image on my own file system. This was a possibility I had in mind, but I'd rather use the API to always ensure the latest data.
Is there a way to use my own app details through OAuth to access this?
Any help would be greatly appreciated.
Thanks,
Michael.
PS - I am using ColdFusion (Railo) to do my server-side based authentication.
The twitter api returns profiles with the images (if you are looking it up) in the key profile_image_url
So you could store them in a cache like:
if(!cacheKeyExists(twitterID)){
// Code to get a twitter profile through monkehtweet
cachePut(twitterID, profile.profile_image_url);
}
return cacheGet(twitterID);
Hope this helps

facebook graph api: how to use me correctly?

i am trying to use /me/likes/pageID the same way i used pages.isFan (REST API).
But it always uses the user/page as me for which i created the access token and not the current active user.
can't get my head around this one, any help is appreciated!
thanks
[from comments] but do i really need to create an application to "just" check if the user is fan of my own page? and even ask his authorization?
Yes, you will need an app in any case.
If you run your app as a canvas or page tab app inside of Facebook, then you get the info if the current user liked the very Facebook fan page the app is running in(!) directly from the signed_request parameter.
If you want to query this infor for other pages, and/or your app is running outside of Facebook, then you have to have the user connect to your app and ask permission to read his likes first, before you can get this info.
For information on the latter case, see https://developers.facebook.com/docs/authentication/, https://developers.facebook.com/docs/authentication/permissions/#user_friends_perms, https://developers.facebook.com/docs/reference/api/user/#likes
It is easy: With the new Graph API, the owner of the access token is me. You can see this by pasting an access token into the debugger.
You should be authenticating your user and gaining an access token in their name each time they visit your site. Then use only this access token when you make your query.
This process is easiest if you use one of the Facebook SDKs.

How to get Google Profile Information of a User in Django?

Is it possible to get a User's Information from Google Profile using Django?
For example, i have an application which does user profiling and the user wants to update the information by his/her google profile.
I guess you should look here http://code.google.com/intl/pl-PL/apis/gdata/articles/python_client_lib.html since gdata provides access to all data stored in Google

Google account authorization for users accessing google docs

I am pulling list of docs in coldfusion via google docs API. I want users to click on the link and get signed in automatically in google docs, with my username and password. Google should not ask user name and password from them.
I tried out this example http://cfgoogle.riaforge.org/
Till now I am able to pull up list of documents I have on my google docs account.
But I want anyone to click those link and get automatically signed in as me. And able to access my documents. Is it possible?
I would guess that accessing the documents as you is not possible via the end-user's browser. Google will set a cookie on your computer identifying your session. This allows you access to documents, mail, etc. whatever is linked in your account. For them to be able to access the documents using your account, they would have to be logged in as you. You can't do that directly from your application, because you can only write cookies for your domain (oversimplification, but basically....)
There may, however, be a workaround.
One option would be to use the API to automatically share the document with the user. That is, they provide their Google ID (not password) and you share with their account. This is probably what I would try.
Alternately, you could proxy requests for documents, although this opens up a whole 'nother can of worms.