# Is there a "log\_in" SSO API endpoint?

**URL:** https://meta.discourse.org/t/is-there-a-log-in-sso-api-endpoint/33545
**Category:** SSO
**Tags:** rest-api
**Created:** [21.Сентябрь.2015 21:36:00 UTC](https://meta.discourse.org/t/is-there-a-log-in-sso-api-endpoint/33545 "2015-09-21T21:36:00Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![dradtke](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dradtke/32/116617_2.png) [@dradtke](https://meta.discourse.org/u/dradtke)
#### Post date: [21.Сентябрь.2015 21:36:00 UTC](https://meta.discourse.org/t/is-there-a-log-in-sso-api-endpoint/33545/1 "2015-09-21T21:36:00Z")

</div>

According to [this post](https://meta.discourse.org/t/official-single-sign-on-for-discourse/13045), logging out from an SSO session is as easy as sending a POST request to `/admin/users/{USER_ID}/log_out`, which I managed to get working fairly easily. My question is, is there an equivalent for logging a user in? I tried `/session/sso`, but ended up getting a 401 error.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [22.Сентябрь.2015 06:23:09 UTC](https://meta.discourse.org/t/is-there-a-log-in-sso-api-endpoint/33545/2 "2015-09-22T06:23:09Z")

</div>

You can’t set cookies for another domain from the server, so that wouldn’t work 😛

Try giving the user a page with this on it:

```plaintext
<embed src="https://discourse.example.com/session/sso" onload="window.location='/login_finished'" width=0 height=0>
<div style="display:flex;justify-content:center;align-items:center">
  <div class="loading-spinner">
  <h1>Please wait, logging you into Discourse...</h1>
  <aside><a href="/login_finished">Click here if you don't want to wait</a></aside>
</div>

```

---

<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: [09.Ноябрь.2018 02:28:50 UTC](https://meta.discourse.org/t/is-there-a-log-in-sso-api-endpoint/33545/3 "2018-11-09T02:28:50Z")

</div>



---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [09.Ноябрь.2018 06:11:58 UTC](https://meta.discourse.org/t/is-there-a-log-in-sso-api-endpoint/33545/4 "2018-11-09T06:11:58Z")

</div>


