[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,648건 12 페이지
  • RSS
기술자료 목록
2428
PHP   9730  2020-11-06 20:08  
열람
SNS   10492  2020-11-05 14:21 ~ 2020-12-12 09:07  
2426
SNS   5769  2020-11-05 11:50 ~ 2020-11-23 03:24  
2425
SNS   7868  2020-11-03 19:16 ~ 2020-11-23 03:17  
2424
그누보드   5364  2020-10-19 06:39 ~ 2022-02-01 09:57  
2423
그누보드   5045  2020-10-16 17:08 ~ 2020-10-20 00:43  
2422
그누보드   5835  2020-10-14 12:34 ~ 2021-03-23 18:09  
2421
그누보드   6192  2020-10-13 14:01  
2420
MySQL   5285  2020-10-12 14:22  
2419
Editor   8106  2020-10-11 11:46 ~ 2020-10-12 09:49  
2418
Adobe   6095  2020-10-10 09:15  
2417
MySQL   22430  2020-10-09 15:48  
2416
Editor   6722  2020-10-07 17:53 ~ 2020-10-07 18:05  
2415
그누보드   6420  2020-10-06 11:32 ~ 2020-11-17 10:39  
2414
SNS   7189  2020-09-28 11:23 ~ 2020-11-23 03:07  
2413
SNS   9963  2020-09-27 11:12 ~ 2020-12-12 09:02  
2412
그누보드   7930  2020-09-24 09:28 ~ 2020-09-24 09:35  
2411
HTML   6361  2020-09-08 23:42 ~ 2020-09-08 23:53  
2410
WordPress   5335  2020-08-31 19:37 ~ 2020-08-31 20:31  
2409
MySQL   9201  2020-08-30 21:37 ~ 2020-08-31 13:29  

검색

해피정닷컴 정보

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

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