Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on Bot OAuth #81

Open
byrnereese opened this issue Apr 3, 2019 · 2 comments
Open

Error on Bot OAuth #81

byrnereese opened this issue Apr 3, 2019 · 2 comments

Comments

@byrnereese
Copy link
Contributor

Once I got the server running I immediately went to add the bot to glip. Clicking the button I can see the request coming in, but get the following error:

CLMRC8950:glip-chatbot-weekly-reports byrne.reese$ ./bin/start
Use database built-in filedb
 * Serving Flask app "devtest" (lazy loading)
 * Environment: development
 * Debug mode: on
 * Running on http://localhost:9890/ (Press CTRL+C to quit)
 * Restarting with stat
Use database built-in filedb
 * Debugger is active!
 * Debugger PIN: 337-740-747



2019-04-03 12:46:16 ('got event', {'pathParameters': {'action': 'bot-oauth'}, 'queryStringParameters': {'code': 'U0pDMTFQMDFQQVMwMHxBQUNDaXJydWg4Si03QXowYTR4c2o1aWxFZDVyZURuNkFmYzlCaW5RMWJjWE50RG9CdDIyZXVpWHNnMjJLMDhUdnNGNF9QWWRPMEVYNENYQjd4dmJsWHJoNE9WNy1DUWp5Y2FySjZnLXFTN2lGcEgzUGwydFN5QjVVVlRRMmVmUXBrd19xZGUxVElUWG1sRzcybkp2RjhZRC0ybjltV2hDekd0UEl1UVdlT1FLamd8WXh4bmt3fDNQbUVvTks5ZlZzdU8zQXV2TDJja1F8QUE', 'client_id': 'JRUKGVRYTl2r2Vrx67C0iw', 'creator_account_id': '230919004', 'creator_extension_id': '230919004'}, 'body': {}, 'headers': {'Host': '797f0531.ngrok.io', 'User-Agent': 'Apache-HttpClient/4.5.2 (Java/1.8.0_172)', 'Accept-Encoding': 'gzip,deflate', 'X-Forwarded-Proto': 'https', 'X-Forwarded-For': '199.68.212.132'}})
2019-04-03 12:46:16 ('action=====', 'bot-oauth')
2019-04-03 12:46:16 ('event=====', {'pathParameters': {'action': 'bot-oauth'}, 'queryStringParameters': {'code': 'U0pDMTFQMDFQQVMwMHxBQUNDaXJydWg4Si03QXowYTR4c2o1aWxFZDVyZURuNkFmYzlCaW5RMWJjWE50RG9CdDIyZXVpWHNnMjJLMDhUdnNGNF9QWWRPMEVYNENYQjd4dmJsWHJoNE9WNy1DUWp5Y2FySjZnLXFTN2lGcEgzUGwydFN5QjVVVlRRMmVmUXBrd19xZGUxVElUWG1sRzcybkp2RjhZRC0ybjltV2hDekd0UEl1UVdlT1FLamd8WXh4bmt3fDNQbUVvTks5ZlZzdU8zQXV2TDJja1F8QUE', 'client_id': 'JRUKGVRYTl2r2Vrx67C0iw', 'creator_account_id': '230919004', 'creator_extension_id': '230919004'}, 'body': {}, 'headers': {'Host': '797f0531.ngrok.io', 'User-Agent': 'Apache-HttpClient/4.5.2 (Java/1.8.0_172)', 'Accept-Encoding': 'gzip,deflate', 'X-Forwarded-Proto': 'https', 'X-Forwarded-For': '199.68.212.132'}})
2019-04-03 12:46:16  error:
HTTP status code: 403

{
  "errorCode" : "InsufficientPermissions",
  "message" : "In order to call this API endpoint, application needs to have [ReadAccounts] permission",
  "errors" : [ {
    "errorCode" : "CMN-401",
    "message" : "In order to call this API endpoint, application needs to have [ReadAccounts] permission",
    "permissionName" : "ReadAccounts"
  } ],
  "permissionName" : "ReadAccounts"
}
127.0.0.1 - - [03/Apr/2019 12:46:16] "GET /bot-oauth?code=U0pDMTFQMDFQQVMwMHxBQUNDaXJydWg4Si03QXowYTR4c2o1aWxFZDVyZURuNkFmYzlCaW5RMWJjWE50RG9CdDIyZXVpWHNnMjJLMDhUdnNGNF9QWWRPMEVYNENYQjd4dmJsWHJoNE9WNy1DUWp5Y2FySjZnLXFTN2lGcEgzUGwydFN5QjVVVlRRMmVmUXBrd19xZGUxVElUWG1sRzcybkp2RjhZRC0ybjltV2hDekd0UEl1UVdlT1FLamd8WXh4bmt3fDNQbUVvTks5ZlZzdU8zQXV2TDJja1F8QUE&client_id=JRUKGVRYTl2r2Vrx67C0iw&creator_account_id=230919004&creator_extension_id=230919004 HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2309, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2295, in wsgi_app
    response = self.handle_exception(e)
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1741, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/byrne.reese/Projects/ringcentral/glip-chatbot-weekly-reports/dev/server/server.py", line 26, in act
    response = framework.router(event)
  File "/usr/local/lib/python3.7/site-packages/ringcentral_bot_framework/core/__init__.py", line 135, in router
    return router(event)
  File "/usr/local/lib/python3.7/site-packages/ringcentral_bot_framework/core/route.py", line 46, in router
    return handler(event)
  File "/usr/local/lib/python3.7/site-packages/ringcentral_bot_framework/core/bot_oauth.py", line 13, in botAuth
    bot.auth(code)
  File "/usr/local/lib/python3.7/site-packages/ringcentral_bot_framework/core/bot.py", line 64, in auth
    txt = json.loads(info.text)
AttributeError: 'bool' object has no attribute 'text'
@byrnereese
Copy link
Contributor Author

I have confirmed that the app has ReadAccounts privs.

@byrnereese
Copy link
Contributor Author

Oh good lord. So I restarted the server, and the error went away and I successfully added the bot to glip.

Question - is ReadAccounts really necessary? Why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant