Skip to content

fix: add PHP secure cookie flag and C# token revocation example (gap report)#711

Open
tamalchowdhury wants to merge 2 commits intomainfrom
tamal/update/sdk-local-dev-and-revocation
Open

fix: add PHP secure cookie flag and C# token revocation example (gap report)#711
tamalchowdhury wants to merge 2 commits intomainfrom
tamal/update/sdk-local-dev-and-revocation

Conversation

@tamalchowdhury
Copy link
Copy Markdown
Collaborator

@tamalchowdhury tamalchowdhury commented Apr 13, 2026

Two SDK doc fixes surfaced in the March 2026 gap report:

  • PHP SDK — adds a setCookieSecure(false) example under Cookie settings for developers running Laravel/PHP apps over HTTP locally. The Secure flag blocks cookies on HTTP, which is a common local dev blocker.
  • .NET SDK — adds a ## Revoke a token section with a correct C# example calling /oauth2/revoke. The AI bot was previously returning code for /oauth2/token (token fetch) instead, which is incorrect and misleading.

Summary by CodeRabbit

  • Documentation
    • Added token revocation guidance and examples for revoking access and refresh tokens, including expected response and invalidation behavior.
    • Added guidance for disabling the Secure cookie flag for local PHP development, with usage notes and a warning to keep it enabled in production.

@tamalchowdhury tamalchowdhury requested a review from a team as a code owner April 13, 2026 06:39
@github-actions github-actions Bot added the sdk label Apr 13, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f9711de9-d585-4346-bf40-985c4dee9528

📥 Commits

Reviewing files that changed from the base of the PR and between ec9f02e and eb9f107.

📒 Files selected for processing (1)
  • src/content/docs/developer-tools/sdks/backend/php-sdk.mdx
✅ Files skipped from review due to trivial changes (1)
  • src/content/docs/developer-tools/sdks/backend/php-sdk.mdx

Walkthrough

Two backend SDK docs (.NET and PHP) were updated: metadata dates set to April 2026; .NET doc adds a "Revoke a token" example (POST /oauth2/revoke with Basic auth and form-encoded token/token_type_hint); PHP doc adds a "Disabling the Secure cookie flag (for local development)" section with sample code.

Changes

Cohort / File(s) Summary
SDK Documentation Updates
src/content/docs/developer-tools/sdks/backend/dotnet-sdk.mdx, src/content/docs/developer-tools/sdks/backend/php-sdk.mdx
Updated document updated metadata to 2026-04-13. .NET doc: added "Revoke a token" section showing POST to /oauth2/revoke using Basic auth (clientId:clientSecret) and form-encoded token + token_type_hint; notes HTTP 200 on success. PHP doc: added "Disabling the Secure cookie flag (for local development)" with Storage::setCookieSecure(false) example and a warning not to disable in production. Also added page-level tableOfContents config (maxHeadingLevel: 3) to PHP doc.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 I hopped through docs with a cheerful nudge,
Tokens revoked and cookies removed for the judge,
Examples tucked tidy, warnings in place,
April's updates with a soft, short grace,
Hooray for clearer dev paths we trudge! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately summarizes the main changes: adding PHP secure cookie flag documentation and C# token revocation example documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tamal/update/sdk-local-dev-and-revocation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 13, 2026

Deploying kinde-docs-preview with  Cloudflare Pages  Cloudflare Pages

Latest commit: eb9f107
Status: ✅  Deploy successful!
Preview URL: https://f72bcb0f.kinde-docs-preview.pages.dev
Branch Preview URL: https://tamal-update-sdk-local-dev-a.kinde-docs-preview.pages.dev

View logs

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/content/docs/developer-tools/sdks/backend/dotnet-sdk.mdx (1)

128-142: Avoid per-request HttpClient construction in the example.

This pattern is non-idiomatic for .NET and can lead to connection-management issues when copied into production code. Prefer a reused/injected client in docs examples.

Suggested doc-safe tweak
-var httpClient = new HttpClient();
+// Reuse a singleton/injected HttpClient (for example via IHttpClientFactory)
+HttpClient httpClient = httpClientFactory.CreateClient();
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/docs/developer-tools/sdks/backend/dotnet-sdk.mdx` around lines
128 - 142, The example creates a new HttpClient per request which is
non-idiomatic and can cause socket exhaustion; change the snippet to demonstrate
using a reused/injected HttpClient (e.g., accept an HttpClient via constructor
or obtain one from IHttpClientFactory) instead of calling new HttpClient()
inside the method that builds the HttpRequestMessage and calls
httpClient.SendAsync; keep the same HttpRequestMessage construction (request,
Authorization header, FormUrlEncodedContent and token fields) but show it using
an injected/reused HttpClient instance (referencing the HttpClient variable, the
HttpRequestMessage variable named request, and the SendAsync call) so consumers
copy the correct pattern for production.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/content/docs/developer-tools/sdks/backend/php-sdk.mdx`:
- Around line 190-197: The MDX block is over-indented causing the fenced PHP
code and the <Aside> to render as code; fix by un-indenting the fenced block and
aside so the code block starts with ```php followed by the two lines using
Storage::getInstance() and setCookieSecure(false) and then a closing ``` on its
own line, then add the <Aside type="warning"> block (with its content Do not
disable the `Secure` flag in production.) on separate, non-indented lines;
ensure references to Storage::getInstance and setCookieSecure remain unchanged.

---

Nitpick comments:
In `@src/content/docs/developer-tools/sdks/backend/dotnet-sdk.mdx`:
- Around line 128-142: The example creates a new HttpClient per request which is
non-idiomatic and can cause socket exhaustion; change the snippet to demonstrate
using a reused/injected HttpClient (e.g., accept an HttpClient via constructor
or obtain one from IHttpClientFactory) instead of calling new HttpClient()
inside the method that builds the HttpRequestMessage and calls
httpClient.SendAsync; keep the same HttpRequestMessage construction (request,
Authorization header, FormUrlEncodedContent and token fields) but show it using
an injected/reused HttpClient instance (referencing the HttpClient variable, the
HttpRequestMessage variable named request, and the SendAsync call) so consumers
copy the correct pattern for production.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2b1fad81-ee47-4571-85d6-b8f4fb6ae566

📥 Commits

Reviewing files that changed from the base of the PR and between d03feb0 and ec9f02e.

📒 Files selected for processing (2)
  • src/content/docs/developer-tools/sdks/backend/dotnet-sdk.mdx
  • src/content/docs/developer-tools/sdks/backend/php-sdk.mdx

Comment thread src/content/docs/developer-tools/sdks/backend/php-sdk.mdx Outdated
@tamalchowdhury tamalchowdhury changed the title ⚠️ fix: add PHP secure cookie flag and C# token revocation example (gap report) fix: add PHP secure cookie flag and C# token revocation example (gap report) Apr 13, 2026

```php
$storage = Storage::getInstance();
$storage->setCookieSecure(false); // Only use this in local/dev environments
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function doesn't exist in the sdk yet.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Any workarounds? or should we drop it? Do suggest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants