Skip to content
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

Use largest avatar returned by Spotify #1209

Closed
2 tasks done
william-matz opened this issue Aug 3, 2023 · 1 comment · Fixed by #1610
Closed
2 tasks done

Use largest avatar returned by Spotify #1209

william-matz opened this issue Aug 3, 2023 · 1 comment · Fixed by #1610
Labels
bug Something isn't working

Comments

@william-matz
Copy link
Contributor

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

I noticed 1-2 weeks ago that the profile images for new users with Spotify Auth are small (64x64), whereas they used to be (300x300). After further investigation, it looks like Spotify's array of images no longer sorts images in reverse size order, so images[0].url is the smaller image now. This looks bad in most avatar implementations.

Expected behavior

The avatars should be sorted by size (Width or Height) and we should return the Url of the largest one.

Additional context

Spotify docs here: https://developer.spotify.com/documentation/web-api/reference/get-current-users-profile

Where to fix: https://github.com/supabase/gotrue/blob/5caacc1f81ff20f8f09f4598b510c767e589a1c5/internal/api/provider/spotify.go#L83C1-L85C3

This seems like a simple fix but I've never written go before. I may attempt it!

@william-matz william-matz added the bug Something isn't working label Aug 3, 2023
@william-matz
Copy link
Contributor Author

ChatGPT is guiding me towards something like this:

var avatarURL string

if len(u.Avatars) >= 1 {
	largestAvatar := u.Avatars[0]
	
	for _, avatar := range u.Avatars {
		if avatar.Height * avatar.Width > largestAvatar.Height * largestAvatar.Width {
			largestAvatar = avatar
		}
	}
	
	avatarURL = largestAvatar.Url
}

@hf hf changed the title Spotify changed their "avatar" implementation and it's returning a really small image by default now Use largest avatar returned by Spotify Jan 19, 2024
hf pushed a commit that referenced this issue Jun 6, 2024
Extracts the largest avatar returned by Spotify, instead of the first
avatar in the list.

Fixes:
- #1209
@hf hf mentioned this issue Jun 6, 2024
@hf hf closed this as completed Jun 6, 2024
J0 pushed a commit that referenced this issue Jun 6, 2024
Re-formats the files from PR #1209.
J0 pushed a commit that referenced this issue Jun 14, 2024
🤖 I have created a release *beep* *boop*
---


##
[2.154.0](v2.153.0...v2.154.0)
(2024-06-12)


### Features

* add max length check for email
([#1508](#1508))
([f9c13c0](f9c13c0))
* add support for Slack OAuth V2
([#1591](#1591))
([bb99251](bb99251))
* encrypt sensitive columns
([#1593](#1593))
([e4a4758](e4a4758))
* upgrade otel to v1.26
([#1585](#1585))
([cdd13ad](cdd13ad))
* use largest avatar from spotify instead
([#1210](#1210))
([4f9994b](4f9994b)),
closes [#1209](#1209)


### Bug Fixes

* define search path in auth functions
([#1616](#1616))
([357bda2](357bda2))
* enable rls & update grants for auth tables
([#1617](#1617))
([28967aa](28967aa))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
uxodb pushed a commit to uxodb/auth that referenced this issue Nov 13, 2024
Extracts the largest avatar returned by Spotify, instead of the first
avatar in the list.

Fixes:
- supabase#1209
uxodb pushed a commit to uxodb/auth that referenced this issue Nov 13, 2024
uxodb pushed a commit to uxodb/auth that referenced this issue Nov 13, 2024
🤖 I have created a release *beep* *boop*
---


##
[2.154.0](supabase/auth@v2.153.0...v2.154.0)
(2024-06-12)


### Features

* add max length check for email
([supabase#1508](supabase#1508))
([f9c13c0](supabase@f9c13c0))
* add support for Slack OAuth V2
([supabase#1591](supabase#1591))
([bb99251](supabase@bb99251))
* encrypt sensitive columns
([supabase#1593](supabase#1593))
([e4a4758](supabase@e4a4758))
* upgrade otel to v1.26
([supabase#1585](supabase#1585))
([cdd13ad](supabase@cdd13ad))
* use largest avatar from spotify instead
([supabase#1210](supabase#1210))
([4f9994b](supabase@4f9994b)),
closes [supabase#1209](supabase#1209)


### Bug Fixes

* define search path in auth functions
([supabase#1616](supabase#1616))
([357bda2](supabase@357bda2))
* enable rls & update grants for auth tables
([supabase#1617](supabase#1617))
([28967aa](supabase@28967aa))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
LashaJini pushed a commit to LashaJini/auth that referenced this issue Nov 13, 2024
Extracts the largest avatar returned by Spotify, instead of the first
avatar in the list.

Fixes:
- supabase#1209
LashaJini pushed a commit to LashaJini/auth that referenced this issue Nov 13, 2024
LashaJini pushed a commit to LashaJini/auth that referenced this issue Nov 13, 2024
🤖 I have created a release *beep* *boop*
---


##
[2.154.0](supabase/auth@v2.153.0...v2.154.0)
(2024-06-12)


### Features

* add max length check for email
([supabase#1508](supabase#1508))
([f9c13c0](supabase@f9c13c0))
* add support for Slack OAuth V2
([supabase#1591](supabase#1591))
([bb99251](supabase@bb99251))
* encrypt sensitive columns
([supabase#1593](supabase#1593))
([e4a4758](supabase@e4a4758))
* upgrade otel to v1.26
([supabase#1585](supabase#1585))
([cdd13ad](supabase@cdd13ad))
* use largest avatar from spotify instead
([supabase#1210](supabase#1210))
([4f9994b](supabase@4f9994b)),
closes [supabase#1209](supabase#1209)


### Bug Fixes

* define search path in auth functions
([supabase#1616](supabase#1616))
([357bda2](supabase@357bda2))
* enable rls & update grants for auth tables
([supabase#1617](supabase#1617))
([28967aa](supabase@28967aa))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
LashaJini pushed a commit to LashaJini/auth that referenced this issue Nov 15, 2024
Extracts the largest avatar returned by Spotify, instead of the first
avatar in the list.

Fixes:
- supabase#1209
LashaJini pushed a commit to LashaJini/auth that referenced this issue Nov 15, 2024
LashaJini pushed a commit to LashaJini/auth that referenced this issue Nov 15, 2024
🤖 I have created a release *beep* *boop*
---


##
[2.154.0](supabase/auth@v2.153.0...v2.154.0)
(2024-06-12)


### Features

* add max length check for email
([supabase#1508](supabase#1508))
([f9c13c0](supabase@f9c13c0))
* add support for Slack OAuth V2
([supabase#1591](supabase#1591))
([bb99251](supabase@bb99251))
* encrypt sensitive columns
([supabase#1593](supabase#1593))
([e4a4758](supabase@e4a4758))
* upgrade otel to v1.26
([supabase#1585](supabase#1585))
([cdd13ad](supabase@cdd13ad))
* use largest avatar from spotify instead
([supabase#1210](supabase#1210))
([4f9994b](supabase@4f9994b)),
closes [supabase#1209](supabase#1209)


### Bug Fixes

* define search path in auth functions
([supabase#1616](supabase#1616))
([357bda2](supabase@357bda2))
* enable rls & update grants for auth tables
([supabase#1617](supabase#1617))
([28967aa](supabase@28967aa))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants