Skip to content

fix: issue with refreshing token when client_secret is not set #513

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

Merged
merged 2 commits into from
Feb 27, 2025

Conversation

anna-romanova
Copy link
Contributor

Fix for #506

Problem: The support for PKCE (Proof Key for Code Exchange) was introduced in the library, making the client_secret field optional (see commit e6afdfb). However, the client_secret field is still included in the list of validated fields in the refresh() method (Service.js#L667).

Issue: When creating a client without setting a client_secret (using PKCE for authentication), the token cannot be refreshed after its default expiration of one hour. This is because the validation check in the refresh() method expects a client_secret, causing an error in the PKCE flow.

Proposed Fix: Adjust the validation logic in the refresh() method to account for the possibility that the client_secret is not provided when using PKCE. This ensures that the token can still be refreshed in the absence of a client_secret.

@anna-romanova anna-romanova changed the title Fix issue with refreshing token when client_secret is not set fix: issue with refreshing token when client_secret is not set Feb 19, 2025
@anna-romanova anna-romanova marked this pull request as ready for review February 19, 2025 20:14
@anna-romanova
Copy link
Contributor Author

Hi @jpoehnelt 👋,

Just a friendly ping — we’re encountering an issue with refreshing the token when using PKCE without setting a client secret. Resolving this in the OAuth2 for Apps Script would be the best solution for us, and I was wondering if you might have some time to look into the proposed changes in this PR.

Any feedback or thoughts would be greatly appreciated! Thanks so much for your time and help.

@jpoehnelt jpoehnelt requested a review from sqrrrl February 27, 2025 16:42
@jpoehnelt jpoehnelt merged commit aae9287 into googleworkspace:main Feb 27, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants