What is the standard or recommended way to store third party passwords in Drupal? Specifically, I want to use oAuth to authenticate a user to Google, and do not want to ask users to type in their passwords each time they access their accounts.


You don't store 3rd party passwords - nor should you get them.

The whole idea behind oAuth is that you will never get the email and password of the user that signed in with google. What you get instead is a token that is valid for a specific period of time for that user. It depends on the provider how long the token is valid, but it could be indefinitely. The smart thing about oAuth is that if you user has an active session on the site you are accessing and have granted your site access, he wont need to do anything. The browser will use his cookie for access and the site will allow you to do what you need since the user already has granted you the access.

So what you need to do is to store the token, typically something that looks like a md5 hash, the username and the site. This can be stored in the database, I would use a custom table unless you have a module that handles this for you.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.