Question

I'm using hybridauth library.

Hybridauth documentation says persistent sessions possible by storing the session data.

Lets say I stored users session data in my database. It contains oauth token, oauth refresh token etc..

Using oauth token, its possible to contact oauth server without asking user permissions.

Now everything fine so far. Now how exactly login the user automatically if the user logged into google?

I mean do I have to use any cookies?

Was it helpful?

Solution

I can't specifically help you on that library you are using, but have you looked at this? https://developers.google.com/accounts/docs/OAuth2Login

If you do an authorization for login as well, you'll get a token back and you can use that to get the userid of the user at Google

This field is only present if the https://www.googleapis.com/auth/userinfo.profile scope was present in the request for the access token. The value of this field is an immutable identifier for the logged-in user. Store this and you should have a durable identifier of the user.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top