application/controllers/Auth.php
/* get New access token using refresh token */
get New access token using refresh token
get New access token using refresh token
public function access_token_post()
	{
		$post_data = $this->post();
		$this->load->helper('security');
		$this->form_validation->set_data($post_data);
		$this->form_validation->set_error_delimiters('', '');
		$this->form_validation->set_rules('refreshToken','Refresh token','required|callback_refresh_token_check');
		if ($this->form_validation->run() === false) {
    		$this->response(array('ResponseCode' => 0, 'ResponseMessage' => 'FAILURE', 'Comments' => validation_errors(),'Result'=>false), 400);
		}else{
			$post_data['token'] = $this->generate_token();
			$post_data['tokenExpiry'] = $this->generate_token_expiry();			
			$access_token = $this->Auth_model->access_token($post_data);
			if ($access_token) {
				$this->response(array('ResponseCode' => 1, 'ResponseMessage' => 'SUCCESS', 'Comments' => 'Refresh token verified successfully','Result'=> $post_data), 200);
			}else{
				$this->response(array('ResponseCode' => 0, 'ResponseMessage' => 'FAILURE', 'Comments' => 'Refresh token is invalid','Result'=>''), 400);
			}
		}
	}
public function access_token_post ( ) { $ post_data = $ this -> post ( ) ; $ this -> load -> helper ( 'security' ) ; $ this -> form_validation -> set_data ( $ post_data ) ; $ this -> form_validation -> set_error_delimiters ( '' , '' ) ; $ this -> form_validation -> set_rules ( 'refreshToken' , 'Refresh token' , 'required|callback_refresh_token_check' ) ; if ( $ this -> form_validation -> run ( ) === false ) { $ this -> response ( array ( 'ResponseCode' => 0 , 'ResponseMessage' => 'FAILURE' , 'Comments' => validation_errors ( ) , 'Result' => false ) , 400 ) ; } else { $ post_data [ 'token' ] = $ this -> generate_token ( ) ; $ post_data [ 'tokenExpiry' ] = $ this -> generate_token_expiry ( ) ; $ access_token = $ this -> Auth_model -> access_token ( $ post_data ) ; if ( $ access_token ) { $ this -> response ( array ( 'ResponseCode' => 1 , 'ResponseMessage' => 'SUCCESS' , 'Comments' => 'Refresh token verified successfully' , 'Result' => $ post_data ) , 200 ) ; } else { $ this -> response ( array ( 'ResponseCode' => 0 , 'ResponseMessage' => 'FAILURE' , 'Comments' => 'Refresh token is invalid' , 'Result' => '' ) , 400 ) ; } } }
get New access token using refresh token
get New access token using refresh token
//$this->form_validation->set_rules('user_id','User Id','required|numeric'); //$this->form_validation->set_rules('device_type','Device type','required'); //$this->form_validation->set_rules('device_token','Device token','required');