abdul
abdul

Reputation: 21

Gmail api asking for credentials after classified with liferay

I have one portlet in liferay which is getting user emails from gmail using web service. I have classified gmail with liferay. It means when I am login into liferay portal, user is automatically login inside gmail.

Now the problem I am facing is, let's say user has cleared the browser history, cookies, everything. After then user opens liferay portal and login into it. So user will be automatically login inside gmail. Up to here it's fine. After that when I click on my portlet, it is calling the gmail webservice for getting emails. As I am already logged in into the gmail, this web service should not ask me for the gmail crendentials again. But it's asking. Let's say if I open "https://mail.google.com/a/edsoa.com" (this is a specific domain url provided by gmail) once in a browser programatically, so it will create a gmail session in browser and after that if I access gmail web service then it will not ask me for the credentials.

So my main concern is, is there any way that I can create gmail session in browser without opening "https://mail.google.com/a/edsoa.com" in browser.

In short what I want to achieve is that if I am already logged in inside gmail, then gmail should never ask me for the credentials even for accessing any gmail web service.

Any help would really be appreciated as I am running out of time.

Thanks and Regards, Abdulbasit F Shaikh.

Upvotes: 0

Views: 121

Answers (1)

Olaf Kock
Olaf Kock

Reputation: 48067

You say that you're accessing gmail through a web service, but refer to the browser being logged in/out - I don't really get your problem: If you're accessing the gmail API (I'm not familiar with it), this is probably independent of the server login.

I'd expect the login to gmail webservice API to be originating from the (Liferay) server, while your browser's identification is - naturally - originating in your browser. Thus, there's no way to initiate a browser session from the (Liferay) server.

You can however try to sign in to Liferay with OpenID - AFAIK google offers this as well. This means you'd provide your credentials to google in order to log in to Liferay. And most likely this will also sign you in to gmail (provided you use the same account)

Upvotes: 0

Related Questions