Add Auth sheet validation for empty/whitespace-only fields#34
Merged
Conversation
Co-authored-by: Shinoryo <78910349+Shinoryo@users.noreply.github.com>
Co-authored-by: Shinoryo <78910349+Shinoryo@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Enhance validation for auth sheet
Add Auth sheet validation for empty/whitespace-only fields
Jan 4, 2026
Shinoryo
reviewed
Jan 4, 2026
…README Co-authored-by: Shinoryo <78910349+Shinoryo@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds validation for authentication sheet fields to prevent OAuth failures caused by empty or whitespace-only values. The changes provide early feedback when configuration is incomplete, replacing cryptic downstream API errors with clear, actionable messages.
Key Changes:
- Added
isBlank()utility function to validate string fields for empty, whitespace-only, null, or undefined values - Implemented validation in
generateAuthUrl()for CLIENT_ID and REDIRECT_URI before auth URL generation - Implemented validation in
doGet()for CLIENT_ID, CLIENT_SECRET, CODE_VERIFIER, and REDIRECT_URI before token exchange - Added MSG_AUTH_FIELD_EMPTY constant for consistent field-specific error messages
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| MicrosoftToDoImporter.gs | Added isBlank() utility function, validation logic in generateAuthUrl() and doGet(), and MSG_AUTH_FIELD_EMPTY constant |
| README.md | Added documentation for the new error message (line 166) describing when validation errors occur |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prevents authentication failures by validating required Auth sheet fields before processing. Previously, empty or whitespace-only values in CLIENT_ID, CLIENT_SECRET, REDIRECT_URI, or CODE_VERIFIER would cause cryptic OAuth errors downstream.
Changes
isBlank()utility: Validates string fields, handling empty strings, whitespace, null, and undefined valuesgenerateAuthUrl(): Checks CLIENT_ID and REDIRECT_URI before generating auth URLdoGet(): Checks CLIENT_ID, CLIENT_SECRET, CODE_VERIFIER, and REDIRECT_URI before token exchangeMSG_AUTH_FIELD_EMPTY: Provides consistent field-specific error messagesExample
Validation occurs before any external API calls, providing immediate feedback when Auth sheet configuration is incomplete.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.