Search code examples
oauthtokenejabberd

How to configure ejabberd with Oauth support


I've tried to follow the steps here to configure ejabberd OAuth but failed. ejabberd.yml looks like below :

-
port: 5280
module: ejabberd_http
request_handlers:
  "/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
## register: true
captcha: true

Note : I've restart the ejabberd.

URL that I used (this is the page where I entered User, Server and Password) : http://mytestsite.com:5280/oauth/authorization_token?response_type=token&client_id=Client1&redirect_uri=http://mytestsite.com&scope=user_get_roster+sasl_auth

I've been redirected to https://mytestsite.com/?error=access_denied&state=&gws_rd=ssl

According to the tutorial, once I enabled /oauth and /api in the .yml file, the following URL should redirect me to http://mytestsite.com/?access_token=RHIT8DoudzOctdzBhYL9bYvXz28xQ4Oj&token_type=bearer&expires_in=3600&scope=user_get_roster+sasl_auth&state=


Solution

  • You must defined oauth_access parameter in ejabberd.yml config file, otherwise, no one can create an oauth token.

    We will update the documentation to make it more accurate on that part.