Monday, December 11, 2017

Access Google gmail Inbox via 3rd Party Application

Hi folks,

Today, I’m come up with a pretty impressive application, which is allow you to access to your gmail inbox and get the feed about the latest email. This simple application based on Atom Google gmail inbox feed. Before I go to development session, let me explain about the atom, according to Google,
Atom is a system which makes it easy for you to receive, in one place, regular updates from news websites, blogs, and/or Gmail. You can use Atom with an aggregator (also known as a newsreader, feed reader, or RSS/Atom reader) to receive new message alerts.Here we go, this is the way to do it.

Pre Requirements.

In order to access gmail account, you have to allow to access ‘less secure Application’. You can easily do it by referring following screen shots.  

Go to Settings and then click Other Google Account settings

Click Apps with account access

Allow to Access Allow less secure apps

I’ll create a separate class to represent email object, and another separate class to get the data from atom the feed.




Get the sample project from GitHub Repository  


Happy Coding,


Best Regards,
Denuwan Himanga

Sunday, April 2, 2017

Implementing SharePoint Online REST client on JAVA platform.

Hi folks,

SharePoint 2013 hosts a Representational State Transfer (REST) service. Using REST API, Developers can interact remotely with SharePoint data by using any technology that supports REST web requests.

SharePoint Online (SPO) REST client request should need to authorize. SharePoint Online Single Sign On (SSO) process validate the REST call and establish connection between SPO and REST client.

In order to establish connection between SPO and REST client, needs to provide following authentication values.

1) rtFa Cookies
2) FedAuth Cookies
3) FormDigestValue

In this post, I’ll demonstrate only implementing a JAVA based RESTful client part and way of passing the above mention authentication values as headers in RESTful call. How to generate the auth values explained in this post. We can simply use generated auth values using POSTMAN case, these values never expire and platform independent.



Happy Coding....

Regards,
Denuwan Himanga

Friday, March 31, 2017

Generate SharePoint Online Rest API Authentications Details Using POSTMAN

Hi folks,
Today, SharePoint Online is the most preferred cloud based platform in many of the organizations to collaborate with external and internal parties, with organizing documents and access the information from any time anywhere.
SharePoint 2013 hosts a Representational State Transfer (REST) service. Using REST API, Developers can interact remotely with SharePoint data by using any technology that supports REST web requests.
In order to communicate SharePoint online REST services you needs to have following authentications keys.

1) BinarySecurityToken
2) rtFa & FedAuth Cookies
3) FormDigestValue 


In this post, I’ll demonstrate how to generate SharePoint Online Rest API authentications keys using Google chrome POSTMAN App.

Generate BinarySecurityToken

In order to get BinarySecurityToken, needs to use Microsoft Security Token Service put above mentioned address as the URL


Needs to add following XML Envelope as a message body, replace [username], [password] & [yourdomain] as per your environment.



When you go through the respond from STS Service, you should notice two main tags among respond envelope. Those are <wst:Lifetime> & <wst:RequestedSecurityToken>. Within RequestedSecurityToken tag we can identify the BinarySecurityToken, which we try to generate in this step, but make sure to follow the second step before the time period within <wst:Lifetime> token. Cause BinarySecurityToken is time based temporary key.   

Generate rtFa & FedAuth Cookies

Now, we need to POST generated BinarySecurityToken to SharePoint Online, if it is valid token SharePoint Online single sign on processes responding with two authentication cookies called rtFa & FedAuth.

In order to get the cookies, you need to enable POSTMAN interceptor. It’s allow to send requests which use browser’s cookies through POSTMAN.

https://[YourDomain].sharepoint.com/_forms/default.aspx?wa=wsignin1.0

Postman : Important sections are Highlighted


Generate FormDigestValue

Form digest value use as a credential validation key in SharePoint architecture. REST API call run inside the firewall, so REST calls are authenticated using the current user's credentials and they can get the form digest value.


Following values should declare as a headers in POSTMAN.
Cookie: rtFa=[rtFa]
Cookie: FedAuth=[ FedAuth]
Origin: [YourDomain].sharepoint.com




REST Call Demo

Using generated authentication values, we can simply test GET request. You need to replace following request as per your environment. Needs to add FormDigestValue as X-RequestDigest in header alone with above mentioned headers in Generate FormDigestValue step.

Additionally, I add optional header which format response as a JSON object.
Accept:application/json;odata=verbose



Happy Coding.
Regards,
Denuwan Himanga