[G5][Google] 사용자 프로필 요청이 실패했습니다. > 기술자료 | 해피정닷컴

[G5][Google] 사용자 프로필 요청이 실패했습니다. > 기술자료

본문 바로가기

사이트 내 전체검색

[G5][Google] 사용자 프로필 요청이 실패했습니다. > 기술자료

SNS [G5][Google] 사용자 프로필 요청이 실패했습니다.

페이지 정보


본문

그누보드 5.4.3 기준

구글 소셜로그인 시도하면 아래와 같이 에러화면이 뜹니다


Error :
사용자 프로필 요청이 실패했습니다.사용자가 해당 서비스에 연결되어 있지 않을 경우도 있습니다. 이 경우 다시 인증 요청을 해야 합니다.





1-1. 그누보드5 / plugin / social / Hybrid / Providers / Google.php  22줄
    public $scope = "https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/plus.me https://www.googleapis.com/auth/plus.profile.emails.read https://www.google.com/m8/feeds/";

를 아래와 같이 변경

    //public $scope = "https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/plus.me https://www.googleapis.com/auth/plus.profile.emails.read https://www.google.com/m8/feeds/";
    public $scope = "https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.google.com/m8/feeds/";


1-2. 그누보드5 / plugin / social / Hybrid / Providers / Google.php  75줄

        $this->refreshToken();

        // ask google api for user infos
        if (strpos($this->scope, '/auth/plus.profile.emails.read') !== false) {
            $verified = $this->api->api("https://www.googleapis.com/plus/v1/people/me");

            if (!isset($verified->id) || isset($verified->error))
                $verified = new stdClass();
        } else {
            $verified = $this->api->api("https://www.googleapis.com/plus/v1/people/me/openIdConnect");

            if (!isset($verified->sub) || isset($verified->error))
                $verified = new stdClass();
        }

        $response = $this->api->api("https://www.googleapis.com/plus/v1/people/me");
        if (!isset($response->id) || isset($response->error)) {
            throw new Exception("User profile request failed! {$this->providerId} returned an invalid response:" . Hybrid_Logger::dumpData( $response ), 6);
        }

        $this->user->profile->identifier = (property_exists($verified, 'id')) ? $verified->id : ((property_exists($response, 'id')) ? $response->id : "");
        $this->user->profile->firstName = (property_exists($response, 'name')) ? $response->name->givenName : "";
        $this->user->profile->lastName = (property_exists($response, 'name')) ? $response->name->familyName : "";
        $this->user->profile->displayName = (property_exists($response, 'displayName')) ? $response->displayName : "";
        $this->user->profile->photoURL = (property_exists($response, 'image')) ? ((property_exists($response->image, 'url')) ? substr($response->image->url, 0, -2) . "200" : '') : '';
        $this->user->profile->profileURL = (property_exists($response, 'url')) ? $response->url : "";
        $this->user->profile->description = (property_exists($response, 'aboutMe')) ? $response->aboutMe : "";
        $this->user->profile->gender = (property_exists($response, 'gender')) ? $response->gender : "";
        $this->user->profile->language = (property_exists($response, 'locale')) ? $response->locale : ((property_exists($verified, 'locale')) ? $verified->locale : "");
        $this->user->profile->email = (property_exists($response, 'email')) ? $response->email : ((property_exists($verified, 'email')) ? $verified->email : "");
        $this->user->profile->emailVerified = (property_exists($verified, 'email')) ? $verified->email : "";

를 아래와 같이 변경

        $this->refreshToken();

        $response = $this->api->api("https://www.googleapis.com/oauth2/v3/userinfo");
        if (!isset($response->sub) || isset($response->error)) {
            throw new Exception("User profile request failed! {$this->providerId} returned an invalid response:" . Hybrid_Logger::dumpData( $response ), 6);
        }

        // ask google api for user infos
        /*
        if (strpos($this->scope, '/auth/plus.profile.emails.read') !== false) {
            $verified = $this->api->api("https://www.googleapis.com/plus/v1/people/me");

            if (!isset($verified->id) || isset($verified->error))
                $verified = new stdClass();
        } else {
            $verified = $this->api->api("https://www.googleapis.com/plus/v1/people/me/openIdConnect");

            if (!isset($verified->sub) || isset($verified->error))
                $verified = new stdClass();
        }

        $response = $this->api->api("https://www.googleapis.com/plus/v1/people/me");
        if (!isset($response->id) || isset($response->error)) {
            throw new Exception("User profile request failed! {$this->providerId} returned an invalid response:" . Hybrid_Logger::dumpData( $response ), 6);
        }
        */

        $this->user->profile->identifier = (property_exists($response, 'sub')) ? $response->sub : "";
        $this->user->profile->firstName = (property_exists($response, 'name')) ? $response->name->givenName : "";
        $this->user->profile->lastName = (property_exists($response, 'name')) ? $response->name->familyName : "";
        $this->user->profile->displayName = (property_exists($response, 'name')) ? $response->name : "";
        $this->user->profile->photoURL = (property_exists($response, 'picture')) ? $response->picture : "";
        $this->user->profile->profileURL = (property_exists($response, 'profile')) ? $response->profile : "";
        $this->user->profile->description = (property_exists($response, 'aboutMe')) ? $response->aboutMe : "";
        $this->user->profile->gender = (property_exists($response, 'gender')) ? $response->gender : "";
        $this->user->profile->language = (property_exists($response, 'locale')) ? $response->locale : "";
        $this->user->profile->email = (property_exists($response, 'email')) ? $response->email : "";
        $this->user->profile->emailVerified = (property_exists($response, 'email_verified')) ? ($response->email_verified === true || $response->email_verified === 1 ? $response->email : "") : "";


2. 그누보드5 / plugin / social / includes / functions.php 내용중

                                    "https://www.googleapis.com/auth/userinfo.email", // optional
를 아래와 같이 변경합니다
                                    //"https://www.googleapis.com/auth/plus.profile.emails.read", // optional
                                    "https://www.googleapis.com/auth/userinfo.email", // optional





참고자료
https://sir.kr/g5_tip/14298
https://sir.kr/g5_plugin/6303

댓글목록

profile_image

ㅇㅇ님의 댓글

ㅇㅇ 이름으로 검색 작성일

이거 기본으로 패치된 걸까요?

profile_image

관리자1님의 댓글의 댓글

관리자1 쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 작성일

이후 그누보드 업그레이드에 적용 되었습니다.


Total 2,643건 1 페이지
  • RSS
기술자료 목록
2643
PHP   277  2025-02-07 09:27 ~ 2025-02-07 16:59  
2642
그누보드   214  2025-02-07 08:55 ~ 2025-02-07 17:04  
2641
그누보드   499  2024-11-26 21:14 ~ 2024-11-26 21:22  
2640
그누보드   577  2024-11-22 10:52 ~ 2024-11-22 11:03  
2639
호스팅   561  2024-11-19 14:41 ~ 2024-11-19 21:17  
2638
Linux   414  2024-11-18 15:45 ~ 2024-11-18 15:48  
2637
일반   405  2024-11-15 16:45 ~ 2024-11-15 16:46  
2636
Secure   439  2024-11-06 18:48 ~ 2024-11-06 18:50  
2635
영카트   633  2024-10-21 13:44 ~ 2024-10-21 19:42  
2634
전자결제   1323  2024-09-05 09:30  
2633
MySQL   1290  2024-03-29 14:14 ~ 2024-03-29 14:14  
2632
그누보드   1486  2024-02-23 18:40 ~ 2024-02-24 06:13  
2631
JavaScript   1608  2024-02-16 18:50 ~ 2024-02-16 20:37  
2630
Java   1607  2024-02-06 16:49  
2629
PHP   1809  2024-02-06 16:42  
2628
호스팅   1654  2024-01-29 12:54  
2627
PHP   1574  2024-01-26 11:04 ~ 2024-01-26 11:13  
2626
MySQL   1688  2024-01-08 17:37 ~ 2024-03-14 16:00  
2625
SQL   1990  2024-01-08 12:36  
2624
영카트   1981  2024-01-04 14:57  

검색

해피정닷컴 정보

회사소개 회사연혁 협력사 오시는길 서비스 이용약관 개인정보 처리방침

회사명: 해피정닷컴   대표: 정창용   전화: 070-7600-3500   팩스: 042-670-8272
주소: (34368) 대전시 대덕구 대화로 160 대전산업용재유통단지 1동 222호
개인정보보호책임자: 정창용   사업자번호: 119-05-36414
통신판매업신고: 제2024-대전대덕-0405호 [사업자등록확인]  
Copyright 2001~2025 해피정닷컴. All Rights Reserved.