Repository navigation
added support for updating user Oauth2 avatars via updateSession method - #13671
Merged
Meldiron merged 6 commits intoSep 21, 2026
Merged
Conversation
Contributor
|
…vable avatar test
Meldiron
approved these changes
Sep 14, 2026
Contributor
Author
|
the failed checks introduced after merging main branch into this PR . |
Meldiron
approved these changes
Sep 21, 2026
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.
What does this PR do?
Adds support for refetching and updating the user's OAuth2 profile photo (
identities.photo) during theupdateSession(PATCH /v1/account/sessions/:sessionId) endpoint.Motivation
Some OAuth2 providers issue rolling or temporary CDN image links for user avatars that expire after a certain duration. While initial OAuth logins populate
identities.photo, callingupdateSessionpreviously only refreshed the provider access tokens without updating the stored profile picture URL.This PR updates
updateSessionso that whenever an OAuth session is refreshed:identitydocument for the session (providerandproviderUid) is located.$oauth2->getUserPhoto($accessToken)is called to refetch the latest avatar URL.identitiesdocument'sphotoattribute is updated in the database.Because
OAuth2::getUserPhoto()safely returns''by default when un-overridden, this feature handles all OAuth2 providers universally without provider-specific logic.Test Plan
Expanded OAuth2 Mock Endpoints (
app/controllers/mock.php):grant_type === 'refresh_token'mock endpoint to return a refreshed access token (refreshed-123456).refreshed-123456returning a refreshed photo URL (/v1/mock/tests/general/oauth2/photo-refreshed)./v1/mock/tests/general/oauth2/photo-refreshed) serving a refreshed profile picture.Expanded E2E Tests (
tests/e2e/Services/Account/AccountCustomClientTest.php):AccountCustomClientTest::testOAuth2to verify that executingPATCH /account/sessions/currentupdates the provider access token torefreshed-123456.GET /avatars/photosuccessfully resolves the updated photo from the refreshed identity document.Automated Verification:
docker compose exec appwrite vendor/bin/phpunit tests/e2e/Services/Account/AccountCustomClientTest.php --filter=testOAuth2OK (1 test, 30 assertions).Related PRs and Issues
Checklist