Skip to content

Error: oauthlib.oauth2.rfc6749.errors.MissingTokenError #4

Open

Description

Hey folks,

I'm trying to get this example code working, as it is pretty close to something I want to build. I keep getting this error in the oauth package. I installed the packages in requirements.txt and am running python within a fresh virtualenv. Anyone have any ideas? Here is the stack trace:

Traceback (most recent call last): File
"/home/alice/Code/projects/bibliography_manager/mendeley_python_example/mendeley-api-python-example/test/lib/python2.7/site-packages/flask/app.py",
line 1836, in __call__ return self.wsgi_app(environ, start_response) File
"/home/alice/Code/projects/bibliography_manager/mendeley_python_example/mendeley-api-python-example/test/lib/python2.7/site-packages/flask/app.py",
line 1820, in wsgi_app response = self.make_response(self.handle_exception(e))
File
"/home/alice/Code/projects/bibliography_manager/mendeley_python_example/mendeley-api-python-example/test/lib/python2.7/site-packages/flask/app.py",
line 1403, in handle_exception reraise(exc_type, exc_value, tb) File
"/home/alice/Code/projects/bibliography_manager/mendeley_python_example/mendeley-api-python-example/test/lib/python2.7/site-packages/flask/app.py",
line 1817, in wsgi_app response = self.full_dispatch_request() File
"/home/alice/Code/projects/bibliography_manager/mendeley_python_example/mendeley-api-python-example/test/lib/python2.7/site-packages/flask/app.py",
line 1477, in full_dispatch_request rv = self.handle_user_exception(e) File
"/home/alice/Code/projects/bibliography_manager/mendeley_python_example/mendeley-api-python-example/test/lib/python2.7/site-packages/flask/app.py",
line 1381, in handle_user_exception reraise(exc_type, exc_value, tb) File
"/home/alice/Code/projects/bibliography_manager/mendeley_python_example/mendeley-api-python-example/test/lib/python2.7/site-packages/flask/app.py",
line 1475, in full_dispatch_request rv = self.dispatch_request() File
"/home/alice/Code/projects/bibliography_manager/mendeley_python_example/mendeley-api-python-example/test/lib/python2.7/site-packages/flask/app.py",
line 1461, in dispatch_request return
self.view_functions[rule.endpoint](**req.view_args) File
"/home/alice/Code/projects/bibliography_manager/mendeley_python_example/mendeley-api-python-example/mendeley-example.py",
line 35, in auth_return mendeley_session = auth.authenticate(request.url) File
"/home/alice/Code/projects/bibliography_manager/mendeley_python_example/mendeley-api-python-example/test/lib/python2.7/site-packages/mendeley/auth.py",
line 68, in authenticate scope=['all']) File
"/home/alice/Code/projects/bibliography_manager/mendeley_python_example/mendeley-api-python-example/test/lib/python2.7/site-packages/requests_oauthlib/oauth2_session.py",
line 199, in fetch_token self._client.parse_request_body_response(r.text,
scope=self.scope) File
"/home/alice/Code/projects/bibliography_manager/mendeley_python_example/mendeley-api-python-example/test/lib/python2.7/site-packages/oauthlib/oauth2/rfc6749/clients/base.py",
line 409, in parse_request_body_response self.token =
parse_token_response(body, scope=scope) File
"/home/alice/Code/projects/bibliography_manager/mendeley_python_example/mendeley-api-python-example/test/lib/python2.7/site-packages/oauthlib/oauth2/rfc6749/parameters.py",
line 376, in parse_token_response validate_token_parameters(params) File
"/home/alice/Code/projects/bibliography_manager/mendeley_python_example/mendeley-api-python-example/test/lib/python2.7/site-packages/oauthlib/oauth2/rfc6749/parameters.py",
line 386, in validate_token_parameters raise
MissingTokenError(description="Missing access token parameter.")
MissingTokenError: (missing_token) Missing access token parameter.

Other info: system is an up to date Arch linux install. I got the same error using 2.7 and 3.4.

Activity

  1. Joyce-Stack commented on Jul 16, 2015

    @Joyce-Stack
    Contributor

    Is this still an issue of you?

  2. alicewriteswrongs commented on Jul 16, 2015

    @alicewriteswrongs
    Author

    Yes, I gave up trying to get the API to work because I was having this error with the example Python code and a similar error with the JavaScript example code.

    For the thing I'm trying to build this is not a problem, since I realized all of the information I want is contained in the BibTeX file I can export from Mendeley Desktop anyway.

  3. Joyce-Stack commented on Jul 27, 2015

    @Joyce-Stack
    Contributor

    I have been able to recreate this and I am working on a fix.

  4. albuspensieve commented on Sep 16, 2015

    @albuspensieve

    same here, when running Authorization code flow, I always get this error.

  5. alicewriteswrongs commented on Sep 16, 2015

    @alicewriteswrongs
    Author

    albus1993 As I said above I actually gave up on trying to get the API to work. I was trying to basically work with my own library, so I found it easier to export it to BibTeX and use a parsing library to import that into a database. If that fits your use case I would recommend trying it - there are BibTeX parsing libraries for most programming languages.

  6. tanimislam commented on Sep 19, 2015

    @tanimislam

    I concur with this error. Any luck figuring out how to fix it? Perhaps an example using flask-oauthlib, with documentation shown here, would be most useful?

  7. jostheim commented on Jan 5, 2016

    @jostheim

    what is the status of this?

  8. rg2410 commented on Apr 15, 2016

    @rg2410

    I had this problem too, any news if it has been solved? Many thanks.

  9. Joyce-Stack commented on Apr 15, 2016

    @Joyce-Stack
    Contributor

    Apologies for not getting back to you on this. Can someone please share their code with me? e.g the exact steps that is causing this?

    Missing the access token parameter means exactly that - maybe something is stripping it out? I'll take a look - Python is not my strongest language so I may need some help.

  10. rg2410 commented on Apr 15, 2016

    @rg2410

    I was running your catalogue example as it is: https://github.com/Mendeley/mendeley-api-python-catalog-example in python 2.7 and using the config file method.

    Thanks.

  11. Joyce-Stack commented on Apr 15, 2016

    @Joyce-Stack
    Contributor

    Are you using a virtualenv or just doing exactly what the instructions say?

  12. rg2410 commented on Apr 15, 2016

    @rg2410

    No environments, like the instructions.

  13. Joyce-Stack commented on Apr 15, 2016

    @Joyce-Stack
    Contributor

    I've committed an update to the Mendeley dependency so can you try again. Perhaps create a virtualenv to ensure you have a dedicated environment. I'm struggling to replicate it but we will update some dependencies and see if any one of them will fix the issue as I research it in the background.

  14. Joyce-Stack commented on Apr 15, 2016

    @Joyce-Stack
    Contributor

    Also can you run a 'pip freeze' and show me your output.

  15. Joyce-Stack commented on Apr 15, 2016

    @Joyce-Stack
    Contributor

    And please clear your cookies and cache before you start.

  16. rg2410 commented on Apr 15, 2016

    @rg2410

    arrow==0.5.0
    certifi==14.5.14
    future==0.14.3
    memoized-property==1.0.2
    mendeley==0.3.0
    oauthlib==0.7.2
    python-dateutil==2.4.0
    PyYAML==3.11
    requests==2.5.1
    requests-oauthlib==0.4.2
    six==1.9.0

    I've created an environment using conda and python2 for this and above is my 'pip freeze' result. Clear chache and cookies because of ipython notebook? I'm running it from a unix terminal in this case.

  17. Joyce-Stack commented on Apr 15, 2016

    @Joyce-Stack
    Contributor

    Have you run pip install -r requirements.txt ?

    I would expect to see something like this (mine):

    Flask==0.10.1
    Jinja2==2.7.3
    MarkupSafe==0.23
    PyYAML==3.11
    Werkzeug==0.10
    argparse==1.2.1
    arrow==0.5.0
    certifi==14.05.14
    future==0.14.3
    itsdangerous==0.24
    memoized-property==1.0.2
    mendeley==0.3.2
    oauthlib==0.7.2
    pyflakes==1.1.0
    python-dateutil==2.4.0
    requests==2.5.1
    requests-oauthlib==0.4.2
    six==1.9.0
    wheel==0.24.0
    wsgiref==0.1.2

  18. rg2410 commented on Apr 15, 2016

    @rg2410

    It's because I am referring to the mendeley-api-python-catalog-example (https://github.com/Mendeley/mendeley-api-python-catalog-example) and not the mendeley-api-python-example. I saw that the mendeley-api-python-example had the same error as I had with the mendeley-api-python-catalog-example and I was checking if anyone had the solution. Apologies if it's not the appropriate channel but the error is the same.
    So my packages are in line with the required ones in the catalogue example.

  19. Joyce-Stack commented on Apr 15, 2016

    @Joyce-Stack
    Contributor

    OK I'm confused now. Can we shut this issue and move it to the correct one?

    No need to apologise.

    Are we discussing the Missing Token error or the state error?

  20. JimHokanson commented on Apr 15, 2016

    @JimHokanson

    For what it is worth, the config example does not make clear that the {} are not required around the id and secret.

    If loaded with the {} the config is loaded with the following format

    {'clientId': {my_client_id: None}, 'clientSecret': {'my_secret_string': None}}

    Importantly this leads to the Mendeley authentication containing a password that is now a dictionary {'my_secret_string': None} and the same with the password {my_client_id: None}

    I have to run but eventually this leads to the "Missing access token parameter" error reported above. Perhaps this is the problem that people are encountering? ....

  21. rg2410 commented on Apr 15, 2016

    @rg2410

    @MendeleyStack - Sure, I will open an issue on mendeley-api-python-catalog-example. It's the missing token error.

    Jim Hokanson (@JimHokanson) - I've seen that too and corrected so that the dictionary has only one entry. Still have the same missing token error.

  22. eenblam commented on Apr 21, 2016

    @eenblam

    Same problem.

    From the Werkzeug debugger (EDIT: from fetch_token in requests_oauthlib/oauth2_session.py):
    r.text is a 401 with u'{"message":"Credentials are required to access this resource."}'
    print(auth.username) => My Mendeley app id
    print(auth.password) => My Mendeley client secret

    Jim Hokanson (@JimHokanson) I removed the {} from config.yml.

    I'm running from Python 2.7.11 in a new Anaconda environment, with requirements built with pip install -r requirements.txt.
    pip freeze:
    arrow==0.5.0
    certifi==14.5.14
    Flask==0.10.1
    future==0.14.3
    itsdangerous==0.24
    Jinja2==2.7.3
    MarkupSafe==0.23
    memoized-property==1.0.2
    mendeley==0.3.2
    oauthlib==0.7.2
    pyflakes==1.1.0
    python-dateutil==2.4.0
    PyYAML==3.11
    requests==2.5.1
    requests-oauthlib==0.4.2
    six==1.9.0
    Werkzeug==0.10

  23. kulharsh commented on Jul 10, 2016

    @kulharsh

    I was facing the same issue for an hour or so today. I had been able to get the example to work last week or so. Finally I realized I made a stupid mistake, I did not update the secret after generating a new one. Complete waste of an hour.
    image

  24. cvivar-a commented on Sep 29, 2016

    @cvivar-a

    Hi, Can someone tell me how you fix the Missing access token parameter?

  25. Joyce-Stack commented on Oct 11, 2016

    @Joyce-Stack
    Contributor

    Hey,

    Have you got something like this in your config.yml file?

    clientId: xxxx
    clientSecret: fsfjasfkljf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions