0
페이스 북 로그인 통합을 위해 Yii2 EAuth를 통합하려고합니다. Nodge/yii2-eauth에서 페이스 북의 이메일 ID를 얻는 방법
나는 ...... 사전에 ... 페이스 북의 이메일 ID를 얻을 수public static function findIdentity($id) {
if (Yii::$app->getSession()->has('user-'.$id)) {
return new self(Yii::$app->getSession()->get('user-'.$id));
}
else {
return isset(self::$users[$id]) ? new self(self::$users[$id]) : null;
}
}
/**
* @param \nodge\eauth\ServiceBase $service
* @return User
* @throws ErrorException
*/
public function findByEAuth($service) {
if (!$service->getIsAuthenticated()) {
throw new ErrorException('EAuth user should be authenticated before creating identity.');
}
$id = $service->getServiceName().'-'.$service->getId();
// echo $id;exit;
print_r($service->getAttribute('email'));
echo '<pre>';
print_r($service->getAttributes());
exit;
$attributes = array(
'id' => $id,
'username' => $service->getAttribute('name'),
'authKey' => md5(@$id),
'profile' => $service->getAttributes(),
);
$attributes['profile']['service'] = $service->getServiceName();
Yii::$app->getSession()->set('user-'.$id, $attributes);
return new self($attributes);
}
내가 이메일을 원한다, pls는 하나가 나를 도울 수있는 코드 아래
을 감사를 사용하고 * 모델 configaration했다