Skip to content

Conversation

@Aryan31v
Copy link

@Aryan31v Aryan31v commented Feb 2, 2026

This PR adds a specific code example and documentation for updating user app_metadata and user_metadata via the auth.update_user() method. This addresses common confusion regarding how to handle these dictionary-based fields in the Python client.

Summary by CodeRabbit

  • Documentation
    • Added a new "Metadata Update" example showing how to update app_metadata and user_metadata (includes a Python usage snippet).
    • Reflowed documentation navigation entries to improve the examples index formatting.

@coderabbitai
Copy link

coderabbitai bot commented Feb 2, 2026

📝 Walkthrough

Walkthrough

Adds a new documentation example page demonstrating how to update app_metadata and user_metadata via auth.update_user(), and updates the examples index to include the new "Metadata Update" entry. Changes are documentation-only; no code logic modified.

Changes

Cohort / File(s) Summary
Documentation — examples
src/auth/docs/source/examples/index.rst, src/auth/docs/source/examples/metadata_update.rst
Inserted a new metadata_update.rst example showing a Python snippet that updates app_metadata and user_metadata via auth.update_user(), and adjusted the examples toctree in index.rst to include the new page.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 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 title clearly and accurately summarizes the main change: adding a new documentation example for updating user metadata. It directly relates to the primary content of the changeset.
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
  • Post copyable unit tests in a comment

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.

Copy link

@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: 3

🤖 Fix all issues with AI agents
In `@src/auth/docs/source/examples/index.rst`:
- Around line 13-15: The toctree entries have inconsistent indentation: "API
</api/api>" and "Client </api/client>" are aligned but "Metadata Update
</examples/metadata_update>" is misindented; edit the toctree so that the
"Metadata Update </examples/metadata_update>" line uses the same leading spaces
as the other entries (match spacing of "API </api/api>" and "Client
</api/client>") to ensure all entries are vertically aligned in the toctree.

In `@src/auth/docs/source/examples/metadata_update.rst`:
- Around line 34-38: The example uses auth.update_user() incorrectly: remove the
trailing .execute() call and the "id" field because auth.update_user() updates
the currently authenticated user and returns the response directly; replace the
payload to only include "app_metadata" and "user_metadata". If you intended a
server/admin update by ID, call auth.admin.update_user_by_id(user_id, {...})
instead of auth.update_user() and pass the metadata object as the second
argument.
- Around line 40-43: Remove the erroneous .execute() call after
supabase.auth.update_user and replace the response.error check with a
try/except: call supabase.auth.update_user(...) directly inside a try block,
print success on success, and catch Exception as e to print the error; update
any references to response.error to use the exception handling flow instead.

@Aryan31v
Copy link
Author

Aryan31v commented Feb 2, 2026

Checking in on this PR. I have updated the code to follow the correct auth pattern (removing .execute() and using direct response handling) and fixed the indentation as suggested. Ready for a final review.

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

Successfully merging this pull request may close these issues.

1 participant