# User profile page by id?

**URL:** https://meta.discourse.org/t/user-profile-page-by-id/118663
**Category:** SSO
**Created:** [May 25, 2019, 2:04pm UTC](https://meta.discourse.org/t/user-profile-page-by-id/118663 "2019-05-25T14:04:02Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![John\_Lehmann](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/john_lehmann/32/140084_2.png) [@John\_Lehmann](https://meta.discourse.org/u/John_Lehmann)
#### Post date: [May 25, 2019, 2:04pm UTC](https://meta.discourse.org/t/user-profile-page-by-id/118663/1 "2019-05-25T14:04:02Z")

</div>

Is there a route to access a public user profile using their id?

I’m aware of: `https://meta.discourse.org/u/{username}/summary`  
And I want: `https://meta.discourse.org/u/{user-id}/summary`

Purpose: I want profiles on my main site to link to profiles on my discourse site. The problem is initially I wasn’t using SSO so the usernames are not all consistent between my two sites, and are being update as the user logout/login. I attempted to “flush” out the old user ids only to realize there is no endpoint for me to update usernames (you can only update email and avatar).

Because usernames are changing, I stored `id` instead, but now I realize I cannot directly generate a URL to get to their profile with id. I would have to do additional web requests which I am trying to avoid. Otherwise, I think I have to hit the `by-external` endpoint once to get the username, but a redirect would be nice.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [May 25, 2019, 2:45pm UTC](https://meta.discourse.org/t/user-profile-page-by-id/118663/2 "2019-05-25T14:45:21Z")

</div>

If you’re trying let users get their own profile, yo can use `/my/summary/`

[https://meta.discourse.org/my/summary](https://meta.discourse.org/my/summary)

---

<div class="post-metadata">

### Author: ![John\_Lehmann](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/john_lehmann/32/140084_2.png) [@John\_Lehmann](https://meta.discourse.org/u/John_Lehmann)
#### Post date: [May 25, 2019, 3:19pm UTC](https://meta.discourse.org/t/user-profile-page-by-id/118663/3 "2019-05-25T15:19:49Z")

</div>

Thanks but no, I want any user viewing a profile on my main site, to be able to click a link on that page to take them to the corresponding profile on the discourse page.

---

<div class="post-metadata">

### Author: ![John\_Lehmann](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/john_lehmann/32/140084_2.png) [@John\_Lehmann](https://meta.discourse.org/u/John_Lehmann)
#### Post date: [May 26, 2019, 11:34am UTC](https://meta.discourse.org/t/user-profile-page-by-id/118663/4 "2019-05-26T11:34:39Z")

</div>

It would be great if there were a PUT endpoint for `username`. The use case is sites like mine which transitioned to SSO, to get all the usernames synced. Then my plan A would have just worked.

My fallback plan I think is going to be to add another column to store `discourse_username` also in my DB along with `discourse_id`. This way, I can directly to their profile with username. The downside is that this username can change. So I need to daily scan all users to re-sync.

---

<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: [May 26, 2019, 6:25pm UTC](https://meta.discourse.org/t/user-profile-page-by-id/118663/5 "2019-05-26T18:25:42Z")

</div>

> [@John\_Lehmann](#):
>
> It would be great if there were a PUT endpoint for `username` . The use case is sites like mine which transitioned to SSO, to get all the usernames synced. Then my plan A would have just worked.

You can make a `POST` request to `/admin/users/sync_sso` for this. If you are using the Discourse API gem, you can use the gem’s `sync_sso` method for this. If you are not using the gem, see [Sync DiscourseConnect user data with the sync\_sso route](https://meta.discourse.org/t/sync-sso-user-data-with-the-sync-sso-route/84398) for details about setting up the request.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [November 12, 2022, 7:42pm UTC](https://meta.discourse.org/t/user-profile-page-by-id/118663/7 "2022-11-12T19:42:40Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
