# Passwordless signin via link generated by api

**URL:** https://meta.discourse.org/t/passwordless-signin-via-link-generated-by-api/79617
**Category:** Feature
**Created:** [February 2, 2018, 10:51am UTC](https://meta.discourse.org/t/passwordless-signin-via-link-generated-by-api/79617 "2018-02-02T10:51:26Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![parisa](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@parisa](https://meta.discourse.org/u/parisa)
#### Post date: [February 2, 2018, 10:51am UTC](https://meta.discourse.org/t/passwordless-signin-via-link-generated-by-api/79617/1 "2018-02-02T10:51:26Z")

</div>

Is it possible? I didn’t see this feature in api.  
I saw that [passwordless signin via email link](https://meta.discourse.org/t/passwordless-signin-via-email-link/57569) is already planned. Maybe this feature would also be possible?  
Use-case: users of my android application are signing in with discourse login api. Now in the application, I show some topics to the users which might be of their interest and want to post somthing. When they click on the topic name, I want to open a webpage with that topic being opened and they would be already logged in. They have already logged in to the app, and I dont want to show another loginpage to them.

---

<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: [February 2, 2018, 1:10pm UTC](https://meta.discourse.org/t/passwordless-signin-via-link-generated-by-api/79617/2 "2018-02-02T13:10:08Z")

</div>

The easiest solution is to make your app’s server be the SSO master. You can search here for sso #howto.

---

<div class="post-metadata">

### Author: ![parisa](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@parisa](https://meta.discourse.org/u/parisa)
#### Post date: [February 2, 2018, 2:35pm UTC](https://meta.discourse.org/t/passwordless-signin-via-link-generated-by-api/79617/3 "2018-02-02T14:35:01Z")

</div>

My problem is not SSO. Discourse is already the source of authentication for my users.  
they login to my app, I do an api call to discourse to see if the user/pass is correct  
now inside app there are some topics from my forum shown. I want the user to be able to click on that topic and a browser or perhaps webview would open that topic while the user is already logged in to the browser too.

---

<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: [February 5, 2018, 8:52pm UTC](https://meta.discourse.org/t/passwordless-signin-via-link-generated-by-api/79617/4 "2018-02-05T20:52:19Z")

</div>

If they get a user api key like our mobile app does then it solves both issues in one go, its a tricky protocol but was designed for this exact problem.

---

<div class="post-metadata">

### Author: ![parisa](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@parisa](https://meta.discourse.org/u/parisa)
#### Post date: [February 6, 2018, 6:11am UTC](https://meta.discourse.org/t/passwordless-signin-via-link-generated-by-api/79617/5 "2018-02-06T06:11:45Z")

</div>

I cant understand it @sam, How I can automatically login to a browser by user api key? Can you give me an example?

---

<div class="post-metadata">

### Author: ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)
#### Post date: [February 6, 2018, 6:14am UTC](https://meta.discourse.org/t/passwordless-signin-via-link-generated-by-api/79617/6 "2018-02-06T06:14:51Z")

</div>

> [@parisa](#):
>
> Can you give me an example?

As Sam said, the official Discourse mobile app does it, and that’s open source.

---

<div class="post-metadata">

### Author: ![parisa](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@parisa](https://meta.discourse.org/u/parisa)
#### Post date: [February 6, 2018, 6:19am UTC](https://meta.discourse.org/t/passwordless-signin-via-link-generated-by-api/79617/7 "2018-02-06T06:19:40Z")

</div>

> [@mpalmer](#):
>
> As Sam said, the official Discourse mobile app does it, and that’s open source.

I’ve tested the mobile app already. I don’t know exactly but it seems it isn’t what I want. I did the following scenario:

1- login in the mobile app  
2- went to chrome browser and logged out there  
3- came back to mobile app, and I was logged out here too and it didn’t automatically login.

in the third step, I expect the mobile app to be able to automatically login me again.

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [October 2, 2018, 8:51am UTC](https://meta.discourse.org/t/passwordless-signin-via-link-generated-by-api/79617/8 "2018-10-02T08:51:51Z")

</div>

Is there any plan to do this? Or should we go for a plugin? I also need this feature. And since it has already been implemented for email, I think its also possible for api to do it.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [October 2, 2018, 9:57am UTC](https://meta.discourse.org/t/passwordless-signin-via-link-generated-by-api/79617/9 "2018-10-02T09:57:49Z")

</div>

@hosna the feature already exists; go to the homepage here, log out, and select “email” as login type.

It is default off though. Do you think we should make it default on for 2.2 @sam?

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [October 2, 2018, 9:59am UTC](https://meta.discourse.org/t/passwordless-signin-via-link-generated-by-api/79617/10 "2018-10-02T09:59:22Z")

</div>

No

I want to generate passwordless signin link via api. I dont want to send the link via email

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [October 2, 2018, 9:59am UTC](https://meta.discourse.org/t/passwordless-signin-via-link-generated-by-api/79617/11 "2018-10-02T09:59:40Z")

</div>

Then you want SSO. Search for SSO here.

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [October 2, 2018, 10:07am UTC](https://meta.discourse.org/t/passwordless-signin-via-link-generated-by-api/79617/12 "2018-10-02T10:07:22Z")

</div>

I think I also dont want SSO . As explained here by @parisa , I also have my application signing in with discourse api. Now I want to put a link to specific topic inside my application. When user clicks on it, they would be redirected to a specific topic, while they should be already sign in (they shouldn’t need to write their username and password)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [October 2, 2018, 10:10am UTC](https://meta.discourse.org/t/passwordless-signin-via-link-generated-by-api/79617/13 "2018-10-02T10:10:27Z")

</div>

That’s SSO, exactly what you described.

---

<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: [October 3, 2018, 12:17am UTC](https://meta.discourse.org/t/passwordless-signin-via-link-generated-by-api/79617/14 "2018-10-03T00:17:20Z")

</div>

> [@codinghorror](#):
>
> Do you think we should make it default on for 2.2

Yes I would like to change this to default on. I just flicked this to enabled by default.

---

<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: [March 4, 2019, 9:35pm UTC](https://meta.discourse.org/t/passwordless-signin-via-link-generated-by-api/79617/15 "2019-03-04T21:35:45Z")

</div>

> [@parisa](#):
>
> I do an api call to discourse to see if the user/pass

This is very confusing to me. If you make this API call you get the `_t` cookie back which you can use. So just use that in your web view?

Or do you somehow have the master API key embedded in your app, if that is the case I would urge you to rethink this asap.

---

<div class="post-metadata">

### Author: ![parisa](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@parisa](https://meta.discourse.org/u/parisa)
#### Post date: [March 5, 2019, 5:15am UTC](https://meta.discourse.org/t/passwordless-signin-via-link-generated-by-api/79617/16 "2019-03-05T05:15:51Z")

</div>

> [@sam](#):
>
> Or do you somehow have the master API key embedded in your app, if that is the case I would urge you to rethink this asap.

No The master api key is not embedded in app. It is embedded in a php code. then I post username and password of user to that php code and check if they are valid. If so, the user is authorized to login to app.
