yammer/yam-python

fetch_access_data does a get instead of post which results in a HTTP 400 Bad Request

Opened this issue · 1 comments

When trying to receive an access_token from the code received via response_url. The yampy module responds with HTTP 400 Bad Request

How to reproduce

import yampy
code = request.GET['code']
authenticator = yampy.Authenticator(
    client_id='MY_KEY',
    client_secret='MY_SECRET'
)
access_token = authenticator.fetch_access_token(code)

How to fix

Use post instead of get
https://developer.yammer.com/docs/oauth-2

def fetch_access_data(self, code):
    [...]
    return client.post(
        path="/access_token",
        client_id=self._client_id,
        client_secret=self._client_secret,
        code=code,
    )

post instead of get does not solve the issue on my computer :-(