그누보드4에서는 절대로 네이버로 로그인하기 API를 적용할 수 없는건가요?
적용할수 있습니다. 다만 그누4에서는 적용이안되서 따로 적용시켜야 합니다.
댓글을 작성하려면 로그인이 필요합니다.
api 는 그누보드 와 관계 없이 연동하실수 있습니다.
다만 그누보드를 잘아는 회원이다보니 그누보드에 적용하려면 아무래도 좀더 용이 하게 작업이
가능하지 않나 생각됩니다.~
그누보드 버전과는 상관없이 연동 가능한 것으로 알고 있습니다.
답변을 작성하려면 로그인이 필요합니다.
이 게시물을 신고 하시겠습니까?신고사유를 선택해주세요.
define( NAVER_SESSION_NAME, "NHN_SESSION" );
@session_start();
class Naver{
private $tokenDatas = array();
private $access_token = ''; // oauth 엑세스 토큰
private $refresh_token = ''; // oauth 갱신 토큰
private $access_token_type = ''; // oauth 토큰 타입
private $access_token_expire = ''; // oauth 토큰 만료
private $client_id = ''; // 네이버에서 발급받은 클라이언트 아이디
private $client_secret = ''; // 네이버에서 발급받은 클라이언트 시크릿키
private $returnURL = ''; // 콜백 받을 URL ( 네이버에 등록된 콜백 URI가 우선됨)
private $state = ''; // 네이버 명세에 필요한 검증 키 (현재 버전 라이브러리에서 미검증)
private $loginMode = 'request'; // 라이브러리 작동 상태
private $returnCode = ''; // 네이버에서 리턴 받은 승인 코드
private $returnState = ''; // 네이버에서 리턴 받은 검증 코드
private $nhnConnectState = false;
// action options
private $autoClose = true;
private $showLogout = true;
private $curl = NULL;
private $refreshCount = 1; // 토큰 만료시 갱신시도 횟수
private $drawOptions = array( "type" => "normal", "width" => "200" );
function __construct($argv = array()) {
if ( ! in_array ('curl', get_loaded_extensions())) {
echo 'curl required';
return false;
}
if($argv['CLIENT_ID']){
$this->client_id = trim($argv['CLIENT_ID']);
}
if($argv['CLIENT_SECRET']){
$this->client_secret = trim($argv['CLIENT_SECRET']);
}
if($argv['RETURN_URL']){
$this->returnURL = trim(urlencode($argv['RETURN_URL']));
}
if($argv['AUTO_CLOSE'] == false){
$this->autoClose = false;
}
if($argv['SHOW_LOGOUT'] == false){
$this->showLogout = false;
}
$this->loadSession();
if(isset($_GET['nhnMode']) && $_GET['nhnMode'] != ''){
$this->loginMode = 'logout';
$this->logout();
}
if($this->getConnectState() == false){
$this->generate_state();
if($_GET['state'] && $_GET['code']){
$this->loginMode = 'request_token';
$this->returnCode = $_GET['code'];
$this->returnState = $_GET['state'];
$this->_getAccessToken();
}
}
}
function login($options = array()){
if(isset($options['type'])){
$this->drawOptions['type'] = $options['type'];
}
if(isset($options['width'])){
$this->drawOptions['width'] = $options['width'];
}
if($this->loginMode == 'request' && (!$this->getConnectState()) || !$this->showLogout){
echo '<a href="javascript:loginNaver();"><img src="https://www.eventmaker.kr/open/idn/naver_login.png" alt="네이버 아이디로 로그인" width="'.$this->drawOptions['width'].'"></a>';
echo '
<script>
function loginNaver(){
var win = window.open(\''.NAVER_OAUTH_URL.'authorize?client_id='.$this->client_id.'&response_type=code&redirect_uri='.$this->returnURL.'&state='.$this->state.'\', \'네이버 아이디로 로그인\',\'width=320, height=480, toolbar=no, location=no\');
var timer = setInterval(function() {
if(win.closed) {
window.location.reload();
clearInterval(timer);
}
}, 500);
}
</script>
';
}else if($this->getConnectState()){
if($this->showLogout){
echo '<a href="http://'.$_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"].'?nhnMode=logout"><img src="https://www.eventmake
이걸 참고해서 하고 있습니다!!!
이걸 참고해서도 가능할까요?