The default user picture (avatar) for a person who doesn’t already have a gravatar associated with their email address looks something like:
In practice, the actual URL associated with this picture looks something like:
https://s.gravatar.com/avatar/3161f22b2e121fdb1279dc1d2a657cac?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fmo.png
Even though it resolves to the image more simply stored at:
https://cdn.auth0.com/avatars/mo.png
In my app I’m using a <canvas>
based component that allows the user to upload and crop a new profile picture. It is supposed to load the current profile picture into the widget, but it doesn’t.
The problem is that the gravatar.com
URL above doesn’t have a CORS header set, so <canvas>
can’t load it.
I guess I have a couple of questions:
- Would it be possible (eventually) for Auth0 to use a different default image that is served from a location with a proper CORS header set? (or possibly to lobby Gravatar to update their server)
- Is this file structure stable/solid enough that I could work around this reliably by just parsing the image filename (everything after the final %2F) and then just append it to
https://cdn.auth0.com/avatars/
?
The second option will meet my needs for now, but ultimately it would be nice not to have to parse the picture URL.
Thanks!