테스트 사이트 - 개발 중인 베타 버전입니다

카카오 가입, 사용자 정보 가져오기가 안됩니다 ㅠ 도와주세요 ㅠ

김병찬 8개월 전 조회 1,546

카카오 가입 및 로그인을 구현하고 있는데
가입시에 동의항목을 생년월일, 성별, 전화번호 등을 했는데 응답값이 아래와 같이 오고 

가입하는 아이디에 따라서 

성별, 생년월일 정보를 받아올 수 가 없거나, 가입화면으로 넘어가지지 않거나 하는 문제가 발생하는데

왜이럴까요? ㅠ

object(stdClass)#6 (31) {
[“identifier”]=>
int(3xxxxxxx7)
[“webSiteURL”]=>
NULL
[“profileURL”]=>
NULL
[“photoURL”]=>
string(109) “http://img1.kakaocdn.net/thumb/R110x110.q70/?fname=http://t1.kakaocdn.net/account_images/default_profile.jpeg" rel="noopener nofollow ugc">http://img1.kakaocdn.net/thumb/R110x110.q70/?fname=http://t1.kakaocdn.net/account_images/default_profile.jpeg
[“displayName”]=>
string(6) “xxxxxx”
[“description”]=>
NULL
[“firstName”]=>
NULL
[“lastName”]=>
NULL
[“gender”]=>
NULL
[“language”]=>
NULL
[“age”]=>
NULL
[“birthDay”]=>
NULL
[“birthMonth”]=>
NULL
[“birthYear”]=>
NULL
[“email”]=>
string(19) “fixxxxxx@gmail.com
[“emailVerified”]=>
NULL
[“phone”]=>
NULL
[“address”]=>
NULL
[“country”]=>
NULL
[“region”]=>
NULL
[“city”]=>
NULL
[“zip”]=>
NULL
[“job_title”]=>
NULL
[“organization_name”]=>
NULL
[“phone_number”]=>
string(16) “+82 10-xxxx-xxxx”
[“name”]=>
string(9) “김xxxxx”
[“birthday”]=>
NULL
[“age_range”]=>
NULL
[“p_age_range”]=>
NULL
[“p_email”]=>
NULL
[“sid”]=>
string(14) “kakao_xxxxxxx0”
[“birthday_needs_agreement”]=>
bool(false)
[“birthyear_needs_agreement”]=>
bool(false)
[“gender_needs_agreement”]=>
bool(false)

}

어떻게 해야할까요?
아래 사용한 참고 코드입니다.
그누보드에서 활용중인데.

</p>

<p>    function getUserProfile()</p>

<p>    {</p>

<p>        $params = array('property_keys' => array(</p>

<p>            'kakao_account.email',</p>

<p>            'kakao_account.birthday',</p>

<p>            'kakao_account.birthyear',</p>

<p>            'kakao_account.gender', // 성별 추가</p>

<p>            'kakao_account.age_range',</p>

<p>            'kakao_account.name',</p>

<p>            'kakao_account.phone_number',</p>

<p>            'kakao_account.profile' // 닉네임, 프로필 사진을 위해 추가</p>

<p>        ));</p>

<p>       </p>

<p>        $this->api->decode_json = false;</p>

<p>        $this->api->curl_header = array( 'Authorization: Bearer ' . $this->api->access_token );</p>

<p>   </p>

<p>        $data = $this->api->api("user/me", "POST", $params);</p>

<p>   </p>

<p>        if ( ! isset( $data->id ) ) {</p>

<p>            throw new Exception("User profile request failed! {$this->providerId} returned an invalid response.", 6);</p>

<p>        }</p>

<p>   </p>

<p>        # store the user profile.</p>

<p>        $this->user->profile->identifier  = @ $data->id;</p>

<p>        $this->user->profile->displayName = @ $data->kakao_account->profile->nickname;</p>

<p>        $this->user->profile->phone_number = @$data->kakao_account->phone_number;</p>

<p>        $this->user->profile->name = @$data->kakao_account->name;</p>

<p>        $this->user->profile->photoURL    = @ $data->kakao_account->profile->thumbnail_image_url;</p>

<p>        $this->user->profile->email = @$data->kakao_account->email;</p>

<p> </p>

<p>       </p>

<p> </p>

<p>        $this->user->profile->birthday_needs_agreement = @$data->kakao_account->birthday_needs_agreement;</p>

<p>        $this->user->profile->birthyear_needs_agreement = @$data->kakao_account->birthyear_needs_agreement;</p>

<p>        $this->user->profile->gender_needs_agreement = @$data->kakao_account->gender_needs_agreement;</p>

<p>       </p>

<p>        $this->user->profile->birthday = @$data->kakao_account->birthday;</p>

<p>        $this->user->profile->birthday = @$data->kakao_account->birthyear;</p>

<p>        $this->user->profile->age_range = @$data->kakao_account->age_range;</p>

<p>   </p>

<p>        // 더이상 사용하지 않는항목</p>

<p>        $this->user->profile->p_age_range = @$data->properties->age_range;</p>

<p>        $this->user->profile->p_email = @$data->properties->email;</p>

<p> </p>

<p>   </p>

<p>        $this->user->profile->sid         = get_social_convert_id( $this->user->profile->identifier, $this->providerId );</p>

<p>   </p>

<p>        return $this->user->profile;</p>

<p>    }</p>

<p>   </p>

<p>

 

이렇게 값들을 불러오고 있는데 값들이

# store the user profile.

$this->user->profile->identifier = @ $data->id;

$this->user->profile->displayName = @ $data->kakao_account->profile->nickname;

$this->user->profile->phone_number = @$data->kakao_account->phone_number;

$this->user->profile->name = @$data->kakao_account->name;

$this->user->profile->photoURL = @ $data->kakao_account->profile->thumbnail_image_url;

$this->user->profile->email = @$data->kakao_account->email;</p>

<p> </p>

<p>여기까지는 동작하는데, 아래의 항목들</p>

<pre>
[code]<button aria-label="전체화면으로 코드 표시"></button></pre>

<p><code data-unknown-hljs-lang="undefined">$this->user->profile->birthday = @$data->kakao_account->birthday; $this->user->profile->age_range = @$data->kakao_account->age_range; // 더이상 사용하지 않는항목 $this->user->profile->p_age_range = @$data->properties->age_range; $this->user->profile->p_email = @$data->properties->email; </code></p>

<p>이부분들이 안불러와집니다.

그리고 동의항목들

$this->user->profile->birthday_needs_agreement = @$data->kakao_account->birthday_needs_agreement;

$this->user->profile->birthyear_needs_agreement = @$data->kakao_account->birthyear_needs_agreement;

$this->user->profile->gender_needs_agreement = @$data->kakao_account->gender_needs_agreement;</p>

<p>

 

이부분들이 false로 불러와져요.

이상한 점은.. 


pxxxxx22@naver.com 이 아이디로 간편가입을 실행하면,
생년월일, 성별 항목이 동의하기 항목에 모두 출력되는데
동의하기 이후에 redirect로 넘어가질 않고,

 

fixxxx32@gmail.com 계정으로 간편가입을 실행하면
생년월일, 성별 항목이 동의하기 항목에 존재하질 않습니다.
그리고 동의하기해서 가입을 하려고 하면 실제 사이트 가입페이지로 넘어가집니다.

아이디에 따라서 이렇게 다르게 나타나는 이유가 뭘까요? 왜이런걸까요.

댓글을 작성하려면 로그인이 필요합니다.

답변 1개

8개월 전

안녕하세요...

@김병찬 님

 

그누보드에서 카카오 가입 및 사용자 정보는 사용자가 별도로 코드 제어할 필요 없이

키 값만 관리자 화면에서 적용하시면 정상적으로 이용할 수 있습니다.

 

다만, 내가 추가적으로 정보 제공이 필요한 경우는 카카오 개발자 센터에서 추가 설정해야 하며,

비지니스 회원이 아니라면 일부 정보는 정보 제공이 제한 되는 점 참고 하시길 바랍니다~

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인