-
-
Notifications
You must be signed in to change notification settings - Fork 433
docs: add example for updating user metadata #1363
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
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughAdds a new documentation example page demonstrating how to update Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this 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.
|
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. |
This PR adds a specific code example and documentation for updating user
app_metadataanduser_metadatavia theauth.update_user()method. This addresses common confusion regarding how to handle these dictionary-based fields in the Python client.Summary by CodeRabbit