# How to login a user via API?

**URL:** https://meta.discourse.org/t/how-to-login-a-user-via-api/134272
**Category:** Development
**Tags:** rest-api
**Created:** [November 23, 2019, 2:43pm UTC](https://meta.discourse.org/t/how-to-login-a-user-via-api/134272 "2019-11-23T14:43:34Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![NathanLei](https://avatars.discourse-cdn.com/v4/letter/n/6bbea6/32.png) [@NathanLei](https://meta.discourse.org/u/NathanLei)
#### Post date: [November 23, 2019, 2:43pm UTC](https://meta.discourse.org/t/how-to-login-a-user-via-api/134272/1 "2019-11-23T14:43:34Z")

</div>

I have gone thought all the topic, None of them explain well, how to log in a user via API. I’m making an APP base on discourse APIs.. someone cares to share a link or code?? please…

---

<div class="post-metadata">

### Author: ![zeroarst](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zeroarst/32/264224_2.png) [@zeroarst](https://meta.discourse.org/u/zeroarst)
#### Post date: [January 23, 2020, 8:23am UTC](https://meta.discourse.org/t/how-to-login-a-user-via-api/134272/2 "2020-01-23T08:23:34Z")

</div>

Hi did you manager to solve the problem? I am looking the same thing. My thing is simple: I just want to validate user by asking username and password, and once logged in successfully. I then save the status in my android app. I don’t want to use SSO because I just want to validate user that’s all.

---

<div class="post-metadata">

### Author: ![tohu](https://avatars.discourse-cdn.com/v4/letter/t/a8b319/32.png) [@tohu](https://meta.discourse.org/u/tohu)
#### Post date: [January 23, 2020, 9:09am UTC](https://meta.discourse.org/t/how-to-login-a-user-via-api/134272/3 "2020-01-23T09:09:53Z")

</div>

There’s a React Native app that you can use as a reference to find out how to login.  
This file in particular should help you get started.

> <https://github.com/pmusaraj/discourse-mobile-single-site-app/blob/main/js/Authenticate.js>

---

<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: [December 7, 2023, 12:34am UTC](https://meta.discourse.org/t/how-to-login-a-user-via-api/134272/4 "2023-12-07T00:34:40Z")

</div>


