Skip to content

docs: Add guide for managing user profile photos (#3280)#643

Open
abdulawalarif wants to merge 3 commits into
serverpod:mainfrom
abdulawalarif:docs/3280-profile-photo-guide
Open

docs: Add guide for managing user profile photos (#3280)#643
abdulawalarif wants to merge 3 commits into
serverpod:mainfrom
abdulawalarif:docs/3280-profile-photo-guide

Conversation

@abdulawalarif

Copy link
Copy Markdown
Contributor

Summary

Addresses serverpod/serverpod#3280.

Adds a procedural guide for uploading, updating, and displaying user profile photos with the v3 auth module. The existing Working with users page covered the edit endpoint API but not the full client flow requested in the issue.

New page: docs/06-concepts/11-authentication/profile-photos.md

  • Before you start — auth setup prerequisites and Flutter dependencies
  • Expose the profile edit endpointUserProfileEndpoint, generated client methods, optional access control
  • Upload a profile photo from Flutter — picker helper, setUserImage, error handling
  • Display the profile photoUserProfileModel.imageUrl, CircleAvatar
  • Remove or replace a photo — v3 vs legacy behavior
  • Configure image size and formatUserProfileConfig and server-side processing
  • Configure storage for production — dev URLs, link to file uploads
  • Use server-side APIs for custom logicAuthServices.instance.userProfiles
  • Verify and Troubleshooting sections

Updated: docs/06-concepts/11-authentication/03-working-with-users.md

  • Adds a link to the new guide under Extending the user profile edit endpoint

Test plan

  • Run npm start and open http://localhost:3000/concepts/authentication/profile-photos
  • Verify all sections render correctly
  • Confirm the link from Working with users to profile-photos resolves
  • Confirm links to setup, file uploads, and legacy working-with-users resolve

@developerjamiu

developerjamiu commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Thanks for this, it's a thorough and accurate guide. A couple of small wording and consistency notes inline.


```dart
final profile = await client.userProfile.setUserImage(byteData);
print(profile.imageUrl); // Uri? — public URL of the new image

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.

Nit: these docs don't use em dashes. There are 9 in this file (lines 54, 94, 112, 266, 268, and 298-301). Could you swap them for periods, commas, or colons? For example on this line, // Uri? — public URL of the new image becomes // Uri?, the public URL of the new image.


## Display the profile photo

`UserProfileModel.imageUrl` is a public `Uri?`. When it is `null`, show a placeholder.

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.

Small readability thing: a few sentences start with a code-formatted word, which reads as a symbol rather than the start of a sentence (this line, plus 162, 208, and 294). Opening with a normal word flows better, for example:

The UserProfileModel.imageUrl field is a public Uri?. When it is null, show a placeholder.

@@ -0,0 +1,301 @@
---

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.

For consistency with the other pages in this folder, which use a numbered filename prefix, could you rename this to something like 07-profile-photos.md? It keeps the sidebar order predictable.


### Restrict who can edit

There is no built-in `userCanEditUserImage` flag in v3 auth (legacy auth had this). Override the endpoint to restrict uploads:

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.

For consistency with the other auth pages, which call this serverpod_auth_idp (or "the authentication module") and the old one "legacy serverpod_auth", could we drop the "v3"/"v2" labels here, on line 81, and on line 301? With the framework on 4.0, "v3 auth" can read as confusing.

abdulawalarif and others added 2 commits June 24, 2026 21:35
Rename to 07-profile-photos.md, remove em dashes, reword sentences
that start with code, and use serverpod_auth_idp/serverpod_auth naming.

Co-authored-by: Cursor <cursoragent@cursor.com>
@abdulawalarif

Copy link
Copy Markdown
Contributor Author

@developerjamiu Thanks for the review! I've addressed all the feedback:

  • Renamed the page to 07-profile-photos.md
  • Replaced all em dashes with periods, commas, or colons
  • Reworded sentences that started with code-formatted words
  • Swapped "v3/v2 auth" for serverpod_auth_idp / legacy serverpod_auth naming

Also merged latest main into the branch. Let me know if anything else should change.

@developerjamiu developerjamiu left a comment

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.

LGTM

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.

2 participants