0

I need to authenticate a D7 user from a php page from outside a Drupal session. In D6 i could have used the md5() function, now i've seen that this is not possible due to changes to D7 authentication. How can i do it without using Drupal functions?

5
  • what parameters would you use to authenticate the user? username and password?
    – AjitS
    Sep 4, 2012 at 10:37
  • yes, only username and passwd; i do not need anything other
    – Cris
    Sep 4, 2012 at 10:40
  • Is there any reason why you don't want to use any Drupal function?
    – apaderno
    Sep 4, 2012 at 14:09
  • I am building a webservice that needs to use some tables in my Drupal database (from which the user table); the WS will be invoked a lot of times so i don't want it to load the Drupal stuff every time, if possible.
    – Cris
    Sep 4, 2012 at 14:23
  • You could also build the web service with Drupal, since it is accessing Drupal data, and only Drupal can authenticate its users.
    – apaderno
    Sep 4, 2012 at 14:38

1 Answer 1

1

If you look in the includes/password.inc file in your drupal 7 installation, you can see how drupal 7 hashes up the password and then code that up separately or just include that file in your other script. A quick tutorial on this can also be found here.

3
  • That would mean to still use Drupal functions. To make it clear to the OP, or future readers, the problem is not using a Drupal function, but including the right file.
    – apaderno
    Sep 4, 2012 at 14:09
  • as I said, 'code that up separately' OR just include the file--the file mentioned includes the logic of how drupal 7 hashes the password.
    – Jimajamma
    Sep 4, 2012 at 14:22
  • If you include includes/password.inc, you are still using Drupal functions, and copying the code from includes/password.inc to another file doesn't make sense, if includes/password.inc is available. The comment was a note for the OP, to say the solution is not avoiding using a Drupal function, but including the right file.
    – apaderno
    Sep 4, 2012 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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