Lucian Radu
Lucian Radu

Reputation: 105

Authentication using Zend Auth whitout password

I'm working on a website which features linkedin and facebook login, but also normal email-password login. I have implemented the login part using Zend Auth, which requires an email and password. But for the Facebook and LinkedIn part, I only need to login using the email provided by the API. Is there a way a to login using Zend Auth but without providind a password? My code looks like this at the moment:

$authAdapter->setTableName('users')

    ->setIdentityColumn('email')

    ->setCredentialColumn('password')

->setCredentialTreatment('SHA1(?)');

Upvotes: 0

Views: 903

Answers (3)

user771071
user771071

Reputation:

To be fair I think you are better off creating your own Authentication adapter instead of abusing the one that already exists.

If it were me I would create an adapter that is specifically for the purpose of your Facebook/LinkedIn authentication and only requires an email address.

If you make sure that it will only be called when you do the Facebook/LinkedIn authentication I think you will be all right.

Upvotes: 0

I have same task when i was need to login users who is logged in from social networks with Oauth2 and dont send email to server i generate password myself for that and log in tham by ID.

    $authAdapter->setTableName('users')
                ->setIdentityColumn('facebook_id')
                ->setCredentialColumn('pass')
                ->setIdentity($id)
                ->setCredential($pass);

Upvotes: 1

Tim
Tim

Reputation: 99

I think its not possible using the default Zend_Auth class.

You could try this way http://www.kirkaas.com/?p=46 or you could pass the identity column as password in case of facebook and co. while creating the account. At the login you could easily catch it if it is a fb login and you can pass the identity column as password and the login will work.

Upvotes: 0

Related Questions