Skip to content
This repository was archived by the owner on Jun 21, 2022. It is now read-only.
This repository was archived by the owner on Jun 21, 2022. It is now read-only.

Invalid request token using Flask example #137

@ChemGuy88

Description

@ChemGuy88

I used the Flask example in this repo, only editing the values CONSUMER_KEY and CONSUMER_SECRET on lines 14 and 15 of khan_api.py, respectively. I then run:

[In] kapi = KhanAPI(CONSUMER_KEY,CONSUMER_SECRET)
[In] kapi.user()
##################################################
Status Code:  401
Content-Type:  text/plain; charset=utf-8
Text:
OAuth error. Invalid access token: abc123
##################################################

where abc123 is my actual consumer key.

I tried troubleshooting it, and got the following three results:

[In] ka = KhanAcademySignIn()
[In] ka.get_callback_url()
.
.
.
RuntimeError: Attempted to generate a URL without the application context being pushed. This has to be executed when application context is available.

[In] ka.authorize()
.
.
.
RuntimeError: Attempted to generate a URL without the application context being pushed. This has to be executed when application context is available.

[In] ka.callback()
.
.
.
RuntimeError: Working outside of request context.

This typically means that you attempted to use functionality that needed
an active HTTP request.  Consult the documentation on testing for
information about how to avoid this problem.

I read the docstring for KhanAcademySignIn and the comment block that follows it, but I don't understand it. Do I need to flesh out the example more, or is there some server-side issue going on?

Thanks for teaching the kids,

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