requests-oauthlib icon indicating copy to clipboard operation
requests-oauthlib copied to clipboard

Token request failed for Schoology

Open croxis opened this issue 7 years ago • 0 comments

I'm using this library via the flask-dance package to add Schoology as a sign in option for my site. For some reason schoology expects GET instead of POST for the request token. Modifying this line to r = self.get(url...) gets it working.

Would the following work as a pull request?

    def _fetch_token(self, url, **request_kwargs):
        log.debug('Fetching token from %s using client %s', url, self._client.client)
        r = self.post(url, **request_kwargs)

        if r.status_code >= 400:
            log.debug('Attempting getting the token instead.')
            r = self.get(url, **request_kwargs)
            if r.status_code >= 400:
                error = "Token request failed with code %s, response was '%s'."
                raise TokenRequestDenied(error % (r.status_code, r.text), r)

croxis avatar Aug 01 '18 22:08 croxis