Drupal 6: Allow external site to authenticate via Drupal
How would I allow a simple PHP site, which already has a user db, to let Drupal handle the logging in of users? I guess I could use services (but I would need help on this) or alternatively is there some way that users are passed to the Drupal login form开发者_如何学运维 to log in, but the simple external PHP site knows, through some kind of cookie arrangement, that the user is logged in?
The main priorities are that the user should only have to log in once for both sites, and the existing users on the external site can be maintained and transitioned smoothly. I want Drupal as the main user db because it's more secure and I think it's easier to have the external authenticate off Drupal rather than the other way around.
Any thoughts?
Bootstrapping Drupal is one way to do this. See : http://drupal.org/node/710560
It does have the overhead of loading other Drupal processes that you may not need, but at least it will give you the ability to add drupal's permissions system into your own app. I found that having the talker .PHP file in the druapl root to be the easiest way of working things; as you see from the above link, the working directories can be problematic.
There are few ways you can do that
- Use drupal as OpenId Provider
- User services module to expose the login service and call it in your php application. This module has good documentation.
I hope this helps.
精彩评论