小编raj*_*ade的帖子

使用plusapi在google时刻发布时,PHP授权失败

我试图在php中发布google plus时刻的帖子,我使用下面的代码,但是当试图发布我收到授权错误时,我正在使用codeignitter

<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');
include_once 'base_controller.php';

class Gp_auth extends Base_controller {

    private $_gp_client;

public function __construct() {
    parent::__construct();

    $this->load->library('googleplus');
    $this->_gp_client = $this->googleplus->client;
}

public function index() {
    if ($this->input->get_post('code')) {
        try {
            $this->_gp_client->authenticate($this->input->get_post('code'));
            $access_token = $this->_gp_client->getAccessToken();
            $this->session->set_userdata('access_token', $access_token);
            redirect('/gp_auth/me');
        } catch (Google_Auth_Exception $e) {
            _print($e);
        }
    } else {
        $this->_gp_client->addScope(array(
            'https://www.googleapis.com/auth/plus.login',
            'https://www.googleapis.com/auth/plus.moments.write'
        ));

        $this->_gp_client->setRequestVisibleActions('http://schemas.google.com/AddActivity');

        try {
            echo anchor($this->_gp_client->createAuthUrl(), 'Conect Me');
        } catch (Google_Auth_Exception $e) {
            _print($e);
        }
    }
}

public function me() {
    try …
Run Code Online (Sandbox Code Playgroud)

php authorization codeigniter google-api-php-client

6
推荐指数
1
解决办法
603
查看次数

为什么我不能在apache中阻止单个node.js文件?

我有一个apache服务器,除了我的应用程序,我有一个node.js websocket应用程序.问题是任何人都可以通过在URL中导航到文件内容来阅读文件内容.我试图阻止直接访问其中一个文件(我已经设法阻止node.js文件夹).

我正在修改我的配置文件:apache2/apache2.conf.假设我的文件在/var/www/server/node_start.js我试图遵循:

<Files /var/www/server/node_start.js>
        Order allow,deny
        Deny from all
</Files>

<FilesMatch /var/www/server/node_start.js>
        Order allow,deny
        Deny from all
</FilesMatch>

<Files /server/node_start.js>
        Order allow,deny
        Deny from all
</Files>

<FilesMatch /server/node_start.js>
        Order allow,deny
        Deny from all
</FilesMatch>
Run Code Online (Sandbox Code Playgroud)

这些都没有成功.我看过其他帖子,看起来我和其他人一样.知道我失败的原因吗?

PS我无法阻止整个目录,因为还有很多其他文件不应该被阻止.

apache node.js

6
推荐指数
1
解决办法
412
查看次数

如何使用Apollo iOS客户端实现graphql订阅

我正在尝试使用apollo ios客户端实现graphql订阅。但是由于缺乏文档示例,因此无法弄清楚。阿波罗文档上给出的示例是:

let apollo: ApolloClient = {
  let configuration = URLSessionConfiguration.default
  // Add additional headers as needed
  configuration.httpAdditionalHeaders = ["Authorization": "Bearer <token>"] // Replace `<token>`

  let url = URL(string: "http://localhost:8080/graphql")!

  return ApolloClient(networkTransport: HTTPNetworkTransport(url: url, configuration: configuration))
}()
Run Code Online (Sandbox Code Playgroud)

APOLLO IOS指南:创建客户端

graphql apollo-ios

6
推荐指数
1
解决办法
1890
查看次数