2017-01-14 2 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

그러나 때마다 나는의 값을 요청 헤더에 추가 및 권한 부여 필드에 의해 토큰과 API에 액세스하려고 : s7rjU649vlnVZUzaGXDtNdLQ1I4r7V2R 베어러 " "오류 코드 32가 표시됩니다."AccessRules : 토큰과 연결된 계정에 작업을 수행 할 수있는 권한이 없습니다. "

- 
    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" 

어떤 생각 나는의 OAuth 토큰을 사용하지 못하는 이유 :

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 –