Skip to main content
added 8 characters in body
Source Link
Mohammad Mujassam
  • 2.2k
  • 7
  • 26
  • 29

What I understand from you question is, You have only email (and obviously some network specific secret key to validate i.e facebook key).

So You just need to load the customer by email id as below.

protected function getCustomerToken($emailId){
 /**
* @var \Magento\Customer\Model\Customer $customer */
*/
$customer->loadByEmail($emailId);
if($customer->getId()){
        /**
        * @var \Magento\Integration\Model\Oauth\TokenFactory $tokenModelFactory 
        */
        $customerToken = $this->tokenModelFactory->create();
        $tokenKey = $customerToken->createCustomerToken($customerId)->getToken();
        return $tokenKey;
}
return "YOU MSG FOR CUSTOMER NOT FOUND";
}

The above code should return the token key without password.

Note: Make sure you are doing proper & strong validating before generating the token & rest is already explained in Franck's answer .

What I understand from you question is, You have only email (and obviously some network specific secret key to validate i.e facebook key).

So You just need to load the customer by email id as below.

protected function getCustomerToken(){
 /**
* @var \Magento\Customer\Model\Customer $customer */
*/
$customer->loadByEmail($emailId);
if($customer->getId()){
        /**
        * @var \Magento\Integration\Model\Oauth\TokenFactory $tokenModelFactory 
        */
        $customerToken = $this->tokenModelFactory->create();
        $tokenKey = $customerToken->createCustomerToken($customerId)->getToken();
        return $tokenKey;
}
return "YOU MSG FOR CUSTOMER NOT FOUND";
}

The above code should return the token key without password.

Note: Make sure you are doing proper & strong validating before generating the token & rest is already explained in Franck's answer .

What I understand from you question is, You have only email (and obviously some network specific secret key to validate i.e facebook key).

So You just need to load the customer by email id as below.

protected function getCustomerToken($emailId){
 /**
* @var \Magento\Customer\Model\Customer $customer */
*/
$customer->loadByEmail($emailId);
if($customer->getId()){
        /**
        * @var \Magento\Integration\Model\Oauth\TokenFactory $tokenModelFactory 
        */
        $customerToken = $this->tokenModelFactory->create();
        $tokenKey = $customerToken->createCustomerToken($customerId)->getToken();
        return $tokenKey;
}
return "YOU MSG FOR CUSTOMER NOT FOUND";
}

The above code should return the token key without password.

Note: Make sure you are doing proper & strong validating before generating the token & rest is already explained in Franck's answer .

What I understand from you question is, You have only email (and obviously some network specific secret key to validate i.e facebook key).

So You just need to load the customer by email id as below.

` protected function getCustomerToken(){ /**

  • @var \Magento\Customer\Model\Customer $customer / / $customer->loadByEmail($emailId); if($customer->getId()){ / * @var \Magento\Integration\Model\Oauth\TokenFactory $tokenModelFactory */ $customerToken = $this->tokenModelFactory->create(); $tokenKey = $customerToken->createCustomerToken($customerId)->getToken(); return $tokenKey; } return "YOU MSG FOR CUSTOMER NOT FOUND"; } `
protected function getCustomerToken(){
 /**
* @var \Magento\Customer\Model\Customer $customer */
*/
$customer->loadByEmail($emailId);
if($customer->getId()){
        /**
        * @var \Magento\Integration\Model\Oauth\TokenFactory $tokenModelFactory 
        */
        $customerToken = $this->tokenModelFactory->create();
        $tokenKey = $customerToken->createCustomerToken($customerId)->getToken();
        return $tokenKey;
}
return "YOU MSG FOR CUSTOMER NOT FOUND";
}

The above code should return the token key without password.

Note: Make sure you are doing proper & strong validating before generating the token & rest is already explained in Franck's answer .

What I understand from you question is, You have only email (and obviously some network specific secret key to validate i.e facebook key).

So You just need to load the customer by email id as below.

` protected function getCustomerToken(){ /**

  • @var \Magento\Customer\Model\Customer $customer / / $customer->loadByEmail($emailId); if($customer->getId()){ / * @var \Magento\Integration\Model\Oauth\TokenFactory $tokenModelFactory */ $customerToken = $this->tokenModelFactory->create(); $tokenKey = $customerToken->createCustomerToken($customerId)->getToken(); return $tokenKey; } return "YOU MSG FOR CUSTOMER NOT FOUND"; } `

The above code should return the token key without password.

Note: Make sure you are doing proper & strong validating before generating the token & rest is already explained in Franck's answer .

What I understand from you question is, You have only email (and obviously some network specific secret key to validate i.e facebook key).

So You just need to load the customer by email id as below.

protected function getCustomerToken(){
 /**
* @var \Magento\Customer\Model\Customer $customer */
*/
$customer->loadByEmail($emailId);
if($customer->getId()){
        /**
        * @var \Magento\Integration\Model\Oauth\TokenFactory $tokenModelFactory 
        */
        $customerToken = $this->tokenModelFactory->create();
        $tokenKey = $customerToken->createCustomerToken($customerId)->getToken();
        return $tokenKey;
}
return "YOU MSG FOR CUSTOMER NOT FOUND";
}

The above code should return the token key without password.

Note: Make sure you are doing proper & strong validating before generating the token & rest is already explained in Franck's answer .

deleted 1 character in body
Source Link
Mohammad Mujassam
  • 2.2k
  • 7
  • 26
  • 29

What I understand from you question is, You have only email (and obviously some network specific secret key to validate i.e facebook key).

So You just need to load the customer by email id as below.

` protected function getCustomerToken(){ /**

  • @var \Magento\Customer\Model\Customer $customer / / $customer->loadByEmail($emailId); if($customer->getId()){ / * @var \Magento\Integration\Model\Oauth\TokenFactory $tokenModelFactory */ $customerToken = $this->tokenModelFactory->create(); $tokenKey = $customerToken->createCustomerToken($customerId)->getToken(); return $tokenCode;$tokenKey; } return "YOU MSG FOR CUSTOMER NOT FOUND"; } `

The above code should return the token key without password.

Note: Make sure you are doing proper & strong validating before generating the token & rest is already explained in Franck's answer .

What I understand from you question is, You have only email (and obviously some network specific secret key to validate i.e facebook key).

So You just need to load the customer by email id as below.

` protected function getCustomerToken(){ /**

  • @var \Magento\Customer\Model\Customer $customer / / $customer->loadByEmail($emailId); if($customer->getId()){ / * @var \Magento\Integration\Model\Oauth\TokenFactory $tokenModelFactory */ $customerToken = $this->tokenModelFactory->create(); $tokenKey = $customerToken->createCustomerToken($customerId)->getToken(); return $tokenCode; } return "YOU MSG FOR CUSTOMER NOT FOUND"; } `

The above code should return the token key without password.

Note: Make sure you are doing proper & strong validating before generating the token & rest is already explained in Franck's answer .

What I understand from you question is, You have only email (and obviously some network specific secret key to validate i.e facebook key).

So You just need to load the customer by email id as below.

` protected function getCustomerToken(){ /**

  • @var \Magento\Customer\Model\Customer $customer / / $customer->loadByEmail($emailId); if($customer->getId()){ / * @var \Magento\Integration\Model\Oauth\TokenFactory $tokenModelFactory */ $customerToken = $this->tokenModelFactory->create(); $tokenKey = $customerToken->createCustomerToken($customerId)->getToken(); return $tokenKey; } return "YOU MSG FOR CUSTOMER NOT FOUND"; } `

The above code should return the token key without password.

Note: Make sure you are doing proper & strong validating before generating the token & rest is already explained in Franck's answer .

Source Link
Mohammad Mujassam
  • 2.2k
  • 7
  • 26
  • 29
Loading