ejabberd - Comments for "ejabberd api oauth help" https://www.ejabberd.im/forum/28861/ejabberd-api-oauth-help en That error says that erlang https://www.ejabberd.im/forum/28861/ejabberd-api-oauth-help#comment-67539 <p>That error says that erlang couldn't fin the definition of the function authorize_password with three arguments in a module called oauth2. This usually means it couldn't find the file oauth.beam. That module is included in a dependency that ejabberd source code downloads automatically during compillation, or is already included in the binary installers.</p> Thu, 22 Jun 2017 08:11:26 +0000 badlop comment 67539 at https://www.ejabberd.im No dice :( I pretty much copy https://www.ejabberd.im/forum/28861/ejabberd-api-oauth-help#comment-67536 <p>No dice :(</p> <p>I pretty much copy pasted the above config (and checked the docs) but got this error:</p> <pre> root@host:/etc/ejabberd# ejabberdctl oauth_issue_token <noindex><a href="mailto:admin@domain.com" rel="nofollow" >admin@domain.com</a></noindex> 3600 "sasl_auth" Problem 'error undef' occurred executing the command. Stacktrace: [{oauth2,authorize_password, [{&lt;&lt;"admin"&gt;&gt;,&lt;&lt;"domain.com"&gt;&gt;}, [&lt;&lt;"sasl_auth"&gt;&gt;], admin_generated], []}, {ejabberd_oauth,oauth_issue_token,3, [{file,"src/ejabberd_oauth.erl"},{line,138}]}, {ejabberd_ctl,call_command,4, [{file,"src/ejabberd_ctl.erl"},{line,324}]}, {ejabberd_ctl,try_call_command,4, [{file,"src/ejabberd_ctl.erl"},{line,298}]}, {ejabberd_ctl,process2,4, [{file,"src/ejabberd_ctl.erl"},{line,247}]}, {ejabberd_ctl,process,2, [{file,"src/ejabberd_ctl.erl"},{line,225}]}, {rpc,'-handle_call_call/6-fun-0-',5, [{file,"rpc.erl"},{line,187}]}] </pre><p> Would this be a bug to be reported?</p> Tue, 20 Jun 2017 15:20:45 +0000 captainparrot comment 67536 at https://www.ejabberd.im > Edit: Reading through the https://www.ejabberd.im/forum/28861/ejabberd-api-oauth-help#comment-67535 <p>&gt; Edit: Reading through the docs again, I wonder if this way is tied to an application which is listening for it? So the redirect?</p> <p>Looking at the documentation, it seems so.</p> <p>Configure access like this:</p> <pre> commands_admin_access: configure commands: - add_commands: - user - restricted oauth_expire: 3600 oauth_access: all </pre><p>Then you can run this in a shell:</p> <pre> $ ejabberdctl oauth_issue_token user1@localhost 3600 "sasl_auth" WzUlRPPxSF6M6KVxCl2Mgw74UrtNCbFn [&lt;&lt;"sasl_auth"&gt;&gt;] 3600 seconds </pre><p>Then, if that's good, you can enable some module to run this command from somewhere else, like ejabberd_xmlrpc or mod_rest.</p> Tue, 20 Jun 2017 09:02:53 +0000 badlop comment 67535 at https://www.ejabberd.im Oh, okay. I removed the https://www.ejabberd.im/forum/28861/ejabberd-api-oauth-help#comment-67533 <p>Oh, okay. I removed the reverse proxy for now. I am now calling http.</p> <p>So i can now get a webpage when i put this in a browser</p> <pre> <noindex><a href="http://domain.com:5280/oauth/authorization_token?response_type=token&amp;client_id=Client1&amp;redirect_uri=http://domain.com&amp;scope=get_roster+sasl_auth" title="http://domain.com:5280/oauth/authorization_token?response_type=token&amp;client_id=Client1&amp;redirect_uri=http://domain.com&amp;scope=get_roster+sasl_auth" rel="nofollow" >http://domain.com:5280/oauth/authorization_token?response_type=token&amp;cli...</a></noindex> </pre><p> and when i try to log in, I get redirected to this url</p> <pre> <noindex><a href="http://domain.com:5280/oauth/authorization_token" title="http://domain.com:5280/oauth/authorization_token" rel="nofollow" >http://domain.com:5280/oauth/authorization_token</a></noindex> </pre><p> But I get a "connection was reset" error. I do not have a firewall or anything blocking connection in use</p> <p>Edit: Reading through the docs again, I wonder if this way is tied to an application which is listening for it? So the redirect? My intension was just to recieve a token so I could use it in a script</p> <p>Edit2: Here is any relevant updated config parts:</p> <pre> listen: - port: 4560 module: ejabberd_xmlrpc access_commands: {} - port: 5280 ip: "0.0.0.0" module: ejabberd_http request_handlers: ## "/pub/archive": mod_http_fileserver "/websocket": ejabberd_http_ws "/log": mod_log_http # OAuth support: "/oauth": ejabberd_oauth # ReST API: "/api": mod_http_api web_admin: true http_poll: true http_bind: true ## register: true captcha: true disable_sasl_mechanisms: ["digest-md5"] command_admin_access: xmlrpc acl: admin: user: - "admin": "domain.com" xmlrpc: user: - "admin": "domain.com" access: xmlrpc: xmlrpc: allow modules: mod_rest: {} mod_admin_extra: {} </pre> Mon, 19 Jun 2017 18:26:38 +0000 captainparrot comment 67533 at https://www.ejabberd.im The listener in port 5281 is https://www.ejabberd.im/forum/28861/ejabberd-api-oauth-help#comment-67532 <p>The listener in port 5281 is not configured to use any encryption, but later in curl you request an https page.</p> Mon, 19 Jun 2017 16:00:37 +0000 badlop comment 67532 at https://www.ejabberd.im