ASANA_ACCESS_TOKEN - asana.error.NoAuthorizationError: No Authorization: Not Authorized
Norfeldt opened this issue · 3 comments
Norfeldt commented
I rewrote the Dockerfile to
FROM python:3
WORKDIR /usr/app
ADD requirements.txt /usr/app/requirements.txt
RUN pip install -r requirements.txt
ADD asana /usr/app/asana
ADD examples /usr/app/examples
ADD tests /usr/app/tests
ADD setup.py /usr/app/setup.py
RUN find . -name '*.pyc' -delete
RUN python --version
RUN python setup.py install
created an .env file with
ASANA_CLIENT_ID=<copied client id from asana>
ASANA_CLIENT_SECRET=<copied client secret from asana>
ASANA_ACCESS_TOKEN=<copied access token from asana>
Then I builded the image
$ docker build --tag asana .
Started the container
docker run --env-file .env --name asana-docker -it asana bash
navigated to the examples folder and tried to start the script example-create-task.py
But it failed to access
then I did
root@<docker-id>:/usr/app/examples# python
Python 3.8.1 (default, Jan 3 2020, 22:44:00)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> import asana
>>> asana.__version__
'0.9.2'
>>> client.users.me()['name']
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.8/site-packages/asana-0.9.2-py3.8.egg/asana/resources/gen/users.py", line 21, in me
File "/usr/local/lib/python3.8/site-packages/asana-0.9.2-py3.8.egg/asana/client.py", line 171, in get
File "/usr/local/lib/python3.8/site-packages/asana-0.9.2-py3.8.egg/asana/client.py", line 89, in request
asana.error.NoAuthorizationError: No Authorization: Not Authorized
Norfeldt commented
okay.. found the issue to be that I used "
around my secret token - in the node app that seemed to be okay (also used an .env file)
now the next error is
Please choose a workspace
0 : norfeldt.dk
1 : Personal Projects
Enter choice (default 0):
Traceback (most recent call last):
File "example-create-task.py", line 34, in <module>
projects = client.projects.find_all({'workspace': workspace['id']})
KeyError: 'id'
rossgrambo-zz commented
For that error, I believe you should change
projects = client.projects.find_all({'workspace': workspace['id']})
to
projects = client.projects.find_all({'workspace': workspace['gid']})
As we're now using string ids which have the key "gid" instead of the key "id"
Norfeldt commented
I just figure that out now as well. But thank you 👍