2017-01-14 8 views
1

私のマシンにeJabberd 16.2をインストールしました。私は郵便配達員を通じてapiにアクセスしようとしています。基本認証を使用すると、すべて正常に動作しています。eJabberd API with OAuth2

私はページからトークンを取得するために管理: http://localhost:5280/oauth/authorization_token?response_type=token&client_id=Client1&scope=get_roster+sasl_auth

しかし、私はの値とリクエストのヘッダに追加し、Authorizationフィールドでトークンを使用してAPIにアクセスしようとするたび:「ベアラs7rjU649vlnVZUzaGXDtNdLQ1I4r7V2R "、エラーコード32が表示されます。" AccessRules:トークンに関連付けられたアカウントに操作を実行する権限がありません。 "私はOAuthのトーク​​ンを使用しない理由

- 
    port: 5280 
    module: ejabberd_http 
    request_handlers: 
     "/http-bind": mod_http_bind 
     "/websocket": ejabberd_http_ws 
     #"/log": mod_log_http 
     # ##OAuth support: 
     "/oauth": ejabberd_oauth 
     # ##ReST API: 
     "/api": mod_http_api 

    ## "/pub/archive": mod_http_fileserver 
    web_admin: true 
    http_bind: true 
    http_poll: true 
    register: true 
    captcha: false 
    commands_admin_access: 
     - allow: 
     - user: "[email protected]" 
    commands: 
     - add_commands: [user, admin, open] 
    oauth_expire: 3600 
    oauth_access: all 

    api_permissions: 
     - "Admin access": 
     - who: 
      - admin 
     - what: 
      - "*" 
      - "!stop" 

任意のアイデア:

これはeJabberd.ymlファイルで設定です。

答えて

0

設定する必要があります:あなたの答えのための

- 
    port: 5280 
    module: ejabberd_http 
    request_handlers: 
     "/websocket": ejabberd_http_ws 
     "/oauth": ejabberd_oauth 
     "/api": ejabberd_http_api 
    web_admin: true 
    http_bind: true 
    ## register: true 
    captcha: false 
    tls: true 
    certfile: "/opt/ejabberd-16.12/conf/server.pem" 

commands_admin_access: configure 
commands: 
    - add_commands: 
    - user 
oauth_expire: 31536000 
oauth_access: all 

api_permissions: 
    - "Admin access": 
    - who: 
     - admin 
    - what: 
     - "*" 
     - "!stop" 
+0

感謝。しかし、それは問題を解決しませんでした。実際に「tls:true」を追加したときは、APIをもう呼び出せませんでした。 –

+0

あなたは正しいと思いますが、トークンを使って登録のような操作を行うことができますが、実際には動作させることができませんでした。 基本認証のみを使用できます そのためのgithubに関する問題 https://github.com/processone/ejabberd/issues/1491 –