# Reset avatar in sync SSO

**URL:** https://meta.discourse.org/t/reset-avatar-in-sync-sso/142294
**Category:** SSO
**Created:** [February 21, 2020, 8:26pm UTC](https://meta.discourse.org/t/reset-avatar-in-sync-sso/142294 "2020-02-21T20:26:33Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![maggiomj](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@maggiomj](https://meta.discourse.org/u/maggiomj)
#### Post date: [February 21, 2020, 8:26pm UTC](https://meta.discourse.org/t/reset-avatar-in-sync-sso/142294/1 "2020-02-21T20:26:33Z")

</div>

I am looking to reset the avatar while using the sync\_sso (back to using the letter\_avatar\_proxy).  
Currently I am passing avatar\_force\_update=true and no value for avatar\_url . Should I be passing an explicit (null?) value for avatar\_url instead? Thanks in advance

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [February 21, 2020, 10:52pm UTC](https://meta.discourse.org/t/reset-avatar-in-sync-sso/142294/2 "2020-02-21T22:52:25Z")

</div>

> [@maggiomj](#):
>
> I am looking to reset the avatar while using the sync\_sso (back to using the letter\_avatar\_proxy).

From looking at the [Discourse SSO](https://meta.discourse.org/t/13045?silent=true) code, I don’t think it is going to be possible to reset a user’s avatar to a letter avatar by calling `sync_sso`. What the code does is try to download the avatar from the URL that is passed with the `avatar_url` parameter. If that parameter is omitted, or set to `null`, or an empty string, no change will be made to the user’s avatar.

---

<div class="post-metadata">

### Author: ![maggiomj](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@maggiomj](https://meta.discourse.org/u/maggiomj)
#### Post date: [March 3, 2020, 9:01pm UTC](https://meta.discourse.org/t/reset-avatar-in-sync-sso/142294/3 "2020-03-03T21:01:43Z")

</div>

How might I request that the API to do such a thing? I attempted to implement a workaround but it’s not quite working out.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [March 3, 2020, 9:20pm UTC](https://meta.discourse.org/t/reset-avatar-in-sync-sso/142294/4 "2020-03-03T21:20:12Z")

</div>

> [@maggiomj](#):
>
> How might I request that the API to do such a thing?

A good approach to figure out what API call to make to perform an action is to perform the action through the Discourse user interface while watching your web inspector’s network tab to find details about the request that is being made. See [How to reverse engineer the Discourse API](https://meta.discourse.org/t/how-to-reverse-engineer-the-discourse-api/20576) for details about this approach.

User avatars can be updated to the system avatar by making an API `PUT` request to

`http://forum.example.com/u/<discourse_username>/preferences/avatar/pick`

Set `type=system` in the request’s form data. You’ll need to substitute your forum’s URL and the Discourse username that you want to update into the URL.

Here’s an example curl request from my local site. I’ve set `$api_key` to my All Users API Key:

```plaintext
curl -X PUT "http://localhost:3000/u/scossar/preferences/avatar/pick" \
-H "Api-Key: $api_key" \
-H "Api-Username: system" \
-H "Content-Type: multipart/form-data;" \
-F "type=system"

```

One thing to note is that this request will fail if you have enabled the `sso overrides avatar` site setting.

---

<div class="post-metadata">

### Author: ![maggiomj](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@maggiomj](https://meta.discourse.org/u/maggiomj)
#### Post date: [March 3, 2020, 9:36pm UTC](https://meta.discourse.org/t/reset-avatar-in-sync-sso/142294/5 "2020-03-03T21:36:40Z")

</div>

> [@simon](#):
>
> `http://forum.example.com/u/<discourse_username>/preferences/avatar/pick`
> 
> Set `type=system` in the request’s form data. You’ll need to substitute your forum’s URL and the Discourse username that you want to update into the URL.

Oddly enough that’s the workaround I tried, but I was seeing inconsistent results. I will bang on it a bit more and report back.
