python-oauth2 icon indicating copy to clipboard operation
python-oauth2 copied to clipboard

[Request] Custom grant_types

Open xamiax opened this issue 10 years ago • 4 comments
trafficstars

I need to use this API. But they are using a custom grant_type (http://scoilnet.com/grants/apikey)

It would be grand, if you could implement an additional (optional) parameter to set a custom grant_type if needed...

xamiax avatar Aug 04 '15 12:08 xamiax

Hey @xamiax, I'm happy to look into this. The second link you posted is broken, can you fix?

rickhanlonii avatar Aug 05 '15 02:08 rickhanlonii

hey thanks for your effort! the second link IS actually the grant_type. As written in the API documentation. maybe the php sdk they provide could be helpful to get it done.

Here is how they manage the grant type there:

private function getAccessTokenFromApiKey($apiKey) {
    if ($this->getVariable('access_token_uri') && $this->getVariable('client_id') && $this->getVariable('client_secret')) {
      return json_decode($this->makeRequest(
        $this->getVariable('access_token_uri'),
        'POST',
        array(
          'grant_type' => 'http://scoilnet.com/grants/apikey',
          'client_id' => $this->getVariable('client_id'),
          'client_secret' => $this->getVariable('client_secret'),
          'api_key' => $apiKey,
        )
      ), TRUE);
    }
    return NULL;
  }

xamiax avatar Aug 05 '15 13:08 xamiax

So is this doable, or should I look for an other solution? :/

xamiax avatar Aug 13 '15 16:08 xamiax

@xamiax I'm going to take a quick look at this now and see if I can see how easy this could be

jaitaiwan avatar Aug 15 '16 03:08 jaitaiwan