I am trying to create a daemon python application which will get emails from outlook server using Microsoft outlook graph API. They have provided excellent tutorial and documentation on how to get it done for python app like django and flask. But I want to create daemon script which can get access code without using web interface(which was used in django).
Note: This app will only collect email from single email and will feed it to db.
Any help is appriciated.
It really depends on what kind of security you need. You can have your daemon/service authenticate with username/password directly, or you can have it authenticate with a certificate.
There are several different authentication scenarios, take a look at the docs page.
Either way, you need to register your daemon as an app in Azure and give it permissions to the Outlook API, just as if it were a web app.
Related
I am starting work on a project that will involve sending an auto generated email to a user. I am (most likely) going to build the application using Python and Django and host it as an Azure web app. The outgoing email address (hello#example.com) is hosted on Office 365. After some digging it looks like the recommended method of sending emails is the 365 Outlook API. All the documentation shows how to authenticate using AAD for a user that is logging in. However, I need to access the same email address regardless of who is using the web app.
Is there a way to securely get access to an AAD token on the backed of the server without storing a password in plaintext? Preferably the it would be in Python or REST but if need be I can switch technologies.
You can create an app only following Client Credentials Grant flow, leveraging which you can authenticate and authorize for AAD in backend.
Here is a code sample on GitHub https://github.com/Azure-Samples/active-directory-python-graphapi-oauth2-0-access, which builds an app-only app leveraging AAD in Django.
Any further concern, please feel free to let me know.
I'm trying to access my GAE app from outside the browser.
At the moment it's Python script but I'm planning desktop C++ app.
I'm fallowing Using OAuth 2.0 for Installed Applications.
So far I managed to access user info:
https://www.googleapis.com/oauth2/v1/userinfo?alt=json
However every call to my GAE ends up with redirection to login page.
Is there a way to do authenticated calls to GAE from a script?
Please take a look at my test code
My goal:
Use Python script on my local machine to get data (json endpoint, static file, html, whatever) from my GAE app as authenticated user.
I believe this is sort of possible using ClientLogin (deprecated) https://developers.google.com/accounts/docs/AuthForInstalledApps.
However, I have found it much easier to just have an API secret string that I use (in a header, over HTTPS) to say that the request is from an approved script.
Alternatively you can do the oauth login flow (whichever flow you want, using your own oauth app), but you don't want to use any login: tags in app.yaml, just do it entirely in your Python code.
I built an IMAP client using this library:
Gmail IMAP and SMTP using OAuth - Libraries and Samples
http://code.google.com/apis/gmail/oauth/code.html
I need to search all the emails in the Inbox and return only those emails matching with my "subject" and which are sent in last 24hrs. Once i have that email i want to read the body and do some processing. I was able to do all of this using above library but when i deploy this code on GAE it fails with with "Security violation" as my code is trying to set some of the following system properties:
props.put("mail.imaps.sasl.enable", "true");
props.put("mail.imaps.sasl.mechanisms", "XOAUTH");
props.put(XoauthSaslClientFactory.OAUTH_TOKEN_PROP, oauthToken);
What are my other alternatives to achieve this task? Few people were talking about RSS feed. Can we achieve what i am looking for using this technique? Any inputs will be appreciated.
Thank You.
I've heard that ContextIO is providing APIs to access GMAIL account. I've tested to get all contacts, emails, files, email's body successfully. The APIs are quite easy to use. You need some steps to obtain ContextIO's Consumer Keys.
They's also providing an API to fetch mails from Google App Engine. Currently, I'm working to bring a demo and hopefully will update this answer soon. However, it's very straight forward and interesting to do :)
App Engine Blogs
Context IO's site
Hope it helps
Google App Engine only allows http/s communication thru the urlfetch API.
IMAP cannot be used on the production servers.
You can try using urlfetch using GMail built in RSS feed (https://USERNAME%3aPASSWORD#gmail.google.com/gmail/feed/atom).
You can use Google Apps script to access your inbox and send the result to App Engine.
http://code.google.com/googleapps/appsscript/service_gmail.html
F.I. I use Apps Script with Google Spreadsheets to make reports, based on data in GAE, using a hmac signature to authenticate.
I'm building an application which uses the Python gdata library to access Google Contacts and I need to authenticate via that library in order to make my requests work. I'm kind of new to this, but basically I'm building a service that runs on a cron job to pull contacts from Google in order to back them up to a local database.
How do I trigger the authentication before I run get_contacts() on the gdata.contacts.client.ContactsClient object? Is there a way I can display either a WebKit browser or use the default browser to authenticate the application? Other than the authentication, it'll be a command line application which will run in the background. How do I do this?
This is for Google Docs, but i think the practice is the same?
import gdata.docs.service
# Create a client class which will make HTTP requests with Google Docs server.
client = gdata.docs.service.DocsService()
# Authenticate using your Google Docs email address and password.
client.ClientLogin('jo#gmail.com', 'password')
# Query the server for an Atom feed containing a list of your documents.
documents_feed = client.GetDocumentListFeed()
# Loop through the feed and extract each document entry.
for document_entry in documents_feed.entry:
# Display the title of the document on the command line.
print document_entry.title.text
More info: http://code.google.com/apis/gdata/articles/python_client_lib.html
I'm currently building a Python webapp on the Google App Engine and I want to expose various parts of my application via a JSON API. This API may be used in the form of a mobile client, or (for the purposes of testing) a headless Python script.
I need to be able to authenticate users before they perform operations on the API. I notice that the Users API does not support simple authentication [in the form of authenticate(username, password)] so merely sending the username/password to a URL and then later using some given token would not work.
Ultimately, I would like the application to use Facebook Connect in addition to its own logins.
Could somebody please suggest how is the best way to authenticate users in this situation, using a remote JSON API and the Google App Engine?
Cheers
You might want to check out the recently released oauth support. Failing that, you can implement your own authentication, for example by using simple or digest authentication.
Just for the record, I ended up going with the wonderful Tipfy framework in the end.