Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add refresh_token to OauthV2Access.php #172

Open
bensicard opened this issue Jul 3, 2024 · 6 comments
Open

Add refresh_token to OauthV2Access.php #172

bensicard opened this issue Jul 3, 2024 · 6 comments

Comments

@bensicard
Copy link

As far as I can see, there is no possibility of using the oauthV2Access method for token refresh.

Can you add it?

// JoliCode\Slack\Api\Endpoint\OauthV2Access

    protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver\OptionsResolver
    {
        $optionsResolver = parent::getQueryOptionsResolver();
        $optionsResolver->setDefined(['client_id', 'client_secret', 'code', 'redirect_uri', 'grant_type', 'refresh_token']);
        $optionsResolver->setDefaults([]);
        $optionsResolver->addAllowedTypes('client_id', ['string']);
        $optionsResolver->addAllowedTypes('client_secret', ['string']);
        $optionsResolver->addAllowedTypes('code', ['string']);
        $optionsResolver->addAllowedTypes('redirect_uri', ['string']);
        $optionsResolver->addAllowedTypes('grant_type', ['string']);
        $optionsResolver->addAllowedTypes('refresh_token', ['string']);

        return $optionsResolver;
    }
@damienalexandre
Copy link
Member

Hello! Thanks for reporting this issue.

It looks like it's missing from Slack OpenApi definition:

https://github.com/jolicode/slack-php-api/blob/31a49b5f54049a1ebb001de2545aff0500d4fdd6/resources/slack-openapi.json#L19403-L19440

That's why it's not allowed in OauthV2Access.

The only way to fix this is to create a new patch: https://github.com/jolicode/slack-php-api/blob/31a49b5f54049a1ebb001de2545aff0500d4fdd6/docs/4-updating-sdk.md#generating-a-new-patch (because there specification is really not good, we keep a list of patches to improve it before building the PHP client).

Would you be available to give it a try?

Thanks

@bensicard
Copy link
Author

Okay, I'll look into it.

Will it be quickly updated after that? Because I need it for a project.

@damienalexandre
Copy link
Member

Yes we can release a new version as soon as it's done 👍

@bensicard
Copy link
Author

I can't push my branch to make a pull request.

Sorry, first time contributing to a project, I discover ^^

@damienalexandre
Copy link
Member

Welcome to the open-source world 🎉

To be able to contribute, you have to work on a "fork": https://github.com/jolicode/slack-php-api/fork

It's this fork you must work on (create branches, make changes, etc).

Then when ready, Github will display a button to open a Pull Request on the main project.

@bensicard
Copy link
Author

Thank you very much.

All done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants