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

소셜로그인 채택완료

akworjs0517 5년 전 조회 3,381

/html/plugin/social 과 테마스킨 외에도 social 로그인설정을 하는곳이있나요?

http://maforum.kr/plugin/social/popup.php?provider=github&url=%2Fbbs%2Flogin.php&redirect_to_idp=1">http://도메인/plugin/social/popup.php?provider=github

로 접속하면  Error:알수 없거나 비활성화 된 provider 입니다. 라는 애러가 발생하는데

g5_config 파일도 수정해주었고 관리자페이지에서 GitHub 사용도 체크했는데 어디를 또 수정해야되나요...

 

SocialLogin 관련 메뉴얼이나 자료는 없는건가요?

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

답변 3개

채택된 답변
+20 포인트
그누위즈

/html/plugin/social 에 모든 코어가 들어있습니다.

해당 파일들에 넣으셔야 할겁니다.

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

답변에 대한 댓글 1개

a
akworjs0517
5년 전
/html/plugin/social/Hybrid/Providers 경로에 GitHub.php 파일을 생성하고
위의 답변글에있는 소스코드를 입력했습니다. 내용은 그누M 에있던 GitHub 파일이구요.
그리고 functions.php 의 social_extends_get_keys 함수에도 위의 답변의 Functions 코드를 입력했습니다. Database는 수정해두었구요. 그런데도 게속 로딩에 실패하네요..

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

akworjs0517
5년 전

- GitHub.php

</p>

<p><?php</p>

<p>/*!</p>

<p>* HybridAuth</p>

<p>* <a href="http://hybridauth.sourceforge.net | https://github.com/hybridauth/hybridauth" target="_blank" rel="noopener noreferrer">http://hybridauth.sourceforge.net | https://github.com/hybridauth/hybridauth</a></p>

<p>*  (c) 2009-2011 HybridAuth authors | hybridauth.sourceforge.net/licenses.html</p>

<p>*/</p>

<p> </p>

<p>/**</p>

<p> * Hybrid_Providers_GitHub</p>

<p> */</p>

<p>class Hybrid_Providers_GitHub extends Hybrid_Provider_Model_OAuth2</p>

<p>{</p>

<p>    // default permissions</p>

<p>    // (no scope) => public read-only access (includes public user profile info, public repo info, and gists).</p>

<p>    public $scope = "user";</p>

<p> </p>

<p>    /**</p>

<p>    * IDp wrappers initializer</p>

<p>    */</p>

<p>    function initialize()</p>

<p>    {</p>

<p>        parent::initialize();</p>

<p> </p>

<p>        // Provider api end-points</p>

<p>        $this->api->api_base_url  = "<a href="https://api.github.com/";" target="_blank" rel="noopener noreferrer">https://api.github.com/";</a></p>

<p>        $this->api->authorize_url = "<a href="https://github.com/login/oauth/authorize";" target="_blank" rel="noopener noreferrer">https://github.com/login/oauth/authorize";</a></p>

<p>        $this->api->token_url     = "<a href="https://github.com/login/oauth/access_token";" target="_blank" rel="noopener noreferrer">https://github.com/login/oauth/access_token";</a></p>

<p>    }</p>

<p> </p>

<p>    /**</p>

<p>    * load the user profile from the IDp api client</p>

<p>    */</p>

<p>    function getUserProfile()</p>

<p>    {</p>

<p>        $data = $this->api->api( "user" );</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>        $this->user->profile->identifier  = @ $data->id;</p>

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

<p>        $this->user->profile->description = @ $data->bio;</p>

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

<p>        $this->user->profile->profileURL  = @ $data->html_url;</p>

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

<p>        $this->user->profile->webSiteURL  = @ $data->blog;</p>

<p>        $this->user->profile->region      = @ $data->location;</p>

<p> </p>

<p>        if( empty($this->user->profile->displayName) ){</p>

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

<p>        }</p>

<p> </p>

<p>        // request user emails from github api</p>

<p>        if( empty($data->email) ){</p>

<p>            try{</p>

<p>                $emails = $this->api->api("user/emails");</p>

<p> </p>

<p>                // fail gracefully, and let apps collect the email if not present</p>

<p>                if (is_array($emails)) {</p>

<p>                    foreach ($emails as $email) {</p>

<p>                        if ($email instanceof stdClass</p>

<p>                            && property_exists($email, 'primary')</p>

<p>                            && true === $email->primary</p>

<p>                            && property_exists($email, 'email')</p>

<p>                        ) {</p>

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

<p> </p>

<p>                            // record whether the email address is verified</p>

<p>                            if (property_exists($email, 'verified')</p>

<p>                                && true === $email->verified</p>

<p>                            ) {</p>

<p>                                $this->user->profile->emailVerified = $email->email;</p>

<p>                            }</p>

<p> </p>

<p>                            break;</p>

<p>                        }</p>

<p>                    }</p>

<p>                }</p>

<p>            }</p>

<p>            catch( GithubApiException $e ){</p>

<p>                throw new Exception( "User email request failed! {$this->providerId} returned an error: $e", 6 );</p>

<p>            }</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>    *</p>

<p>    */</p>

<p>    function getUserContacts() {</p>

<p>        // refresh tokens if needed</p>

<p>        $this->refreshToken();</p>

<p> </p>

<p>        //</p>

<p>        $response = array();</p>

<p>        $contacts = array();</p>

<p>        try {</p>

<p>            $response = $this->api->api( "user/followers" );</p>

<p>        } catch (Exception $e) {</p>

<p>            throw new Exception("User contacts request failed! {$this->providerId} returned an error: $e");</p>

<p>        }</p>

<p>        //</p>

<p>        if ( isset( $response ) ) {</p>

<p>            foreach ($response as $contact) {</p>

<p>                try {</p>

<p>                    $contactInfo = $this->api->api( "users/".$contact->login );</p>

<p>                } catch (Exception $e) {</p>

<p>                    throw new Exception("Contact info request failed for user {$contact->login}! {$this->providerId} returned an error: $e");</p>

<p>                }</p>

<p>                //</p>

<p>                $uc = new Hybrid_User_Contact();</p>

<p>                //</p>

<p>                $uc->identifier     = $contact->id;</p>

<p>                $uc->profileURL     = @$contact->html_url;</p>

<p>                $uc->webSiteURL     = @$contact->blog;</p>

<p>                $uc->photoURL       = @$contact->avatar_url;</p>

<p>                $uc->displayName    = ( isset( $contactInfo->name )?( $contactInfo->name ):( $contact->login ) );</p>

<p>                //$uc->description  = ;</p>

<p>                $uc->email          = @$contactInfo->email;</p>

<p>                //</p>

<p>                $contacts[] = $uc;</p>

<p>            }</p>

<p>        }</p>

<p>        return $contacts;</p>

<p>    }</p>

<p>}</p>

<p>

 

- Functions : social_extends_get_keys 

</p>

<p>        $r['Github'] = array(</p>

<p>                    "enabled" => option_array_checked('github', $config['cf_social_servicelist']) ? true : false,</p>

<p>                    "keys" => array("id" => $config['cf_github_clientid'],</p>

<p>                    "secret" => $config['cf_github_secret']),</p>

<p>                    "redirect_uri" => get_social_callbackurl('github')</p>

<p>                    //"access_type"     => "offline",   // optional</p>

<p>                    //"approval_prompt" => "force",     // optional</p>

<p>                );</p>

<p>

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

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

메뉴얼들은 예를들면 카카오톡 로그인 API 검색하면 카카오톡 개발페이지에 명시되어있습니다

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

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

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

로그인