Closed Root3287 closed 4 years ago
Hello,
Thanks for opening an issue. As we explain in our documentation, our generated SDK is mainly dependent from the completeness of Slack's official API specification. In this case, their spec indeed only defines one property for the oauth.access
end (ok
- which is not useful at all).
FYI we did not need this endpoint yet because we usually use another package to handle the OAuth2 flow. Thus we did not came across this problem :confused:
To bypass those missing definitions, we have a patch system that allow us to fix their spec and build a better SDK. Fun fact is that their spec often describe - for each endpoint - an example of a response which contains all the fields. So this is quite easy to locally fix the OpenAPI spec, generate a patch and regenerate the SDK. All the procedure is describe in our documentation: https://github.com/jolicode/slack-php-api/blob/master/doc/updating-sdk.md#apply-local-modification
Would you mind to give a try and submit a PR? That would be awesome :wink: If not, don't worry we will try to have a look in the coming days.
Hi,
we've also experienced this problem. In our case response JoliCode\Slack\Api\ModelOauthAccessGetResponse200
of client->oauthAccess()
contains only ok
property and nothing else.
We've implemented workaround that client.oauthAccess
returns raw response \Psr\Http\Message\ResponseInterface
so we can bypass the problem.
$response = $slackClient->oauthAccess(
[
'client_id' => '>clientId<',
'client_secret' => '>clientSecret<',
'code' => '>authCode<',
'redirect_uri' => '>redirectUrl<',
],
JoliCode\Slack\Api\Client::FETCH_RESPONSE
);
$result = json_decode((string) $response->getBody(),TRUE);
$incomingWebhook = $result['incoming_webhook'];
Is there any plan to fix this bug in the library?
I just merged #76 so you should now be able to retrieve the token with the SDK :slightly_smiling_face:
I plan to release this as a new minor version (aka 2.5) in a few days. In the meantime, you can use dev-master version to try it :wink:
Any chance you can do the same change also for: oauthV2Access
Thanks!
When executing the following code. All I was able to access getOk method, There is no way to access the access token.
https://api.slack.com/methods/oauth.access