# Embed Discourse in a native app?

**URL:** https://meta.discourse.org/t/embed-discourse-in-a-native-app/110475
**Category:** Development
**Created:** [3월 1, 2019, 10:26오후 UTC](https://meta.discourse.org/t/embed-discourse-in-a-native-app/110475 "2019-03-01T22:26:47Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![dfabulich](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dfabulich/32/108716_2.png) [@dfabulich](https://meta.discourse.org/u/dfabulich)
#### Post date: [3월 1, 2019, 10:26오후 UTC](https://meta.discourse.org/t/embed-discourse-in-a-native-app/110475/1 "2019-03-01T22:26:47Z")

</div>

Our company has native apps for iOS and Android. One of our goals is to bring people back to our apps frequently, and to spend a lot of time in our apps. (The app stores seem to prioritize apps that get a lot of usage.)

We have a pretty solid Discourse forum, but currently we just link out to the forum’s website from the app. iOS users who want to receive forum push notifications then have to download the Discourse app separately. (Android users can receive push notifications directly from the website, which is great, but in that case, they’re still using the website, and not our app.)

We’d like to make the Discourse forum a part of our existing iOS and Android apps, and especially to allow users to receive forum push notifications in our apps, without forcing people to download a separate app or to leave our app to use the forum. (I’m imagining that the implementation would be a web view, much like the Discourse iOS app.)

Is there a way to do something like this today? (I’m guessing not?)

---

<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: [3월 1, 2019, 11:12오후 UTC](https://meta.discourse.org/t/embed-discourse-in-a-native-app/110475/2 "2019-03-01T23:12:03Z")

</div>

It is possible, but note:

1. You will have cookie / login problems at the moment, particularly on iOS, due to the way embedded Safari is currently working in iOS 12 and beyond.

2. You could certainly consume the Discourse API in the native apps to grab Discourse notifications.

A full in-app webview will be more complicated than simply linking out, and implies more developer support for the native apps.

@sam may have other thoughts.

---

<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: [3월 3, 2019, 10:47오후 UTC](https://meta.discourse.org/t/embed-discourse-in-a-native-app/110475/3 "2019-03-03T22:47:26Z")

</div>

On Android the story is quite simple, spinning up a [Chrome Custom Tab](https://developer.chrome.com/multidevice/android/customtabs) is super easy and it shares authentication with Chrome. Only big downside and reason our Android team members avoid using the Android app (and that we are considering killing the Android app) is cause opening a Chrome Tab is slow compared to PWA, so people prefer the PWA.

Being Android though you could possibly automate creating the PWA link and all that Jazz from your app which may be interesting.

On iOS the story is more complex due to Apple bugs.

We have the `user API key` system @pmusaraj will be working on improving per: [Delegated authentication for Discourse Mobile app](https://meta.discourse.org/t/delegated-authentication-for-discourse-mobile-app/110414) (which also includes adding documentation)

My recommendation here for you @dfabulich is to hold tight for a month or 2 while we redo our protocol and improve documentation.

---

<div class="post-metadata">

### Author: ![dfabulich](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dfabulich/32/108716_2.png) [@dfabulich](https://meta.discourse.org/u/dfabulich)
#### Post date: [3월 4, 2019, 8:25오전 UTC](https://meta.discourse.org/t/embed-discourse-in-a-native-app/110475/4 "2019-03-04T08:25:52Z")

</div>

How would push notifications work in this story? Would I have to poll? (I’d rather do proper remote pushes.)

---

<div class="post-metadata">

### Author: ![Lloyd\_Lau](https://avatars.discourse-cdn.com/v4/letter/l/c6cbf5/32.png) [@Lloyd\_Lau](https://meta.discourse.org/u/Lloyd_Lau)
#### Post date: [3월 4, 2019, 8:49오전 UTC](https://meta.discourse.org/t/embed-discourse-in-a-native-app/110475/5 "2019-03-04T08:49:55Z")

</div>

I read somewhere that Chrome 72 now support Trusted web activities , which means you can now distribute PWAs in the Google play store. If it works well I think you will have more reason to kill the Android app.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [3월 4, 2019, 3:47오후 UTC](https://meta.discourse.org/t/embed-discourse-in-a-native-app/110475/6 "2019-03-04T15:47:36Z")

</div>

It’s a bit involved, since you need the validation key, paying the Google fee, etc. But it does work.

---

<div class="post-metadata">

### Author: ![hellekin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hellekin/32/51636_2.png) [@hellekin](https://meta.discourse.org/u/hellekin)
#### Post date: [3월 4, 2019, 4:34오후 UTC](https://meta.discourse.org/t/embed-discourse-in-a-native-app/110475/7 "2019-03-04T16:34:29Z")

</div>

> [@Lloyd\_Lau](#):
>
> If it works well I think you will have more reason to kill the Android app.

Let me give one good reason not to: some people do not have a Google account and won’t have one. If the app would be distributed over F-Droid, it would be fine, but forcing people into Google is not a friendly move.

---

<div class="post-metadata">

### Author: ![PackElend](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/packelend/32/95294_2.png) [@PackElend](https://meta.discourse.org/u/PackElend)
#### Post date: [7월 28, 2019, 7:47오후 UTC](https://meta.discourse.org/t/embed-discourse-in-a-native-app/110475/8 "2019-07-28T19:47:50Z")

</div>

> [@sam](#):
>
> and that we are considering killing the Android app) is cause opening a Chrome Tab is slow compared to PWA, so people prefer the PWA.

As long as you ensure that it works with Firefox as well is can also solve

> [@hellekin](#):
>
> some people do not have a Google account

Discourse as an open source application should always prefer open source solutions

---

<div class="post-metadata">

### Author: ![dfabulich](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dfabulich/32/108716_2.png) [@dfabulich](https://meta.discourse.org/u/dfabulich)
#### Post date: [3월 5, 2020, 10:37오후 UTC](https://meta.discourse.org/t/embed-discourse-in-a-native-app/110475/9 "2020-03-05T22:37:30Z")

</div>

> [@sam](#):
>
> @dfabulich 님, 프로토콜을 재구성하고 문서를 개선하는 동안 한두 달 정도 기다려 주시는 것을 추천드립니다.

다시 확인해 드립니다! 현재 상황은 어떤가요?

---

<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: [3월 5, 2020, 10:38오후 UTC](https://meta.discourse.org/t/embed-discourse-in-a-native-app/110475/10 "2020-03-05T22:38:51Z")

</div>

위임 인증이 도입되었고, 새로운 로그인 플로우가 앱에서 꽤 안정적으로 작동합니다. 프로토콜은 모두 오픈되어 있습니다.

---

<div class="post-metadata">

### Author: ![dfabulich](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dfabulich/32/108716_2.png) [@dfabulich](https://meta.discourse.org/u/dfabulich)
#### Post date: [3월 5, 2020, 11:01오후 UTC](https://meta.discourse.org/t/embed-discourse-in-a-native-app/110475/11 "2020-03-05T23:01:33Z")

</div>

> [@codinghorror](#):
>
> 1. 네이티브 앱에서 Discourse API를 사용하여 Discourse 알림을 가져오는 것이 확실히 가능합니다.

이 부분에 대한 문서 링크를 알려주실 수 있나요?

---

<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: [3월 6, 2020, 12:42오전 UTC](https://meta.discourse.org/t/embed-discourse-in-a-native-app/110475/12 "2020-03-06T00:42:20Z")

</div>

현재 스펙은 다음과 같습니다:

> [@User API keys specification](https://meta.discourse.org/t/user-api-keys-specification/48536?u=sam):
>
> Discourse contains a system for generating API keys per user if a very specific protocol is followed. This feature facilitates “application” access to Discourse instances without needing to involve moderators. High level description At a high level: Client (desktop app, browser plugin, mobile app) generates a private/public key pair and return url Client redirects to a route on discourse giving discourse its public key Discourse gets approval from user to use app Discourse generat…

확인이 필요한 부분이 있을 수 있으므로 수정을 환영합니다.

공식 구현은 오픈 소스로, 다음 주소에서 확인할 수 있습니다: [GitHub - discourse/DiscourseMobile: Discourse Mobile · GitHub](https://github.com/discourse/DiscourseMobile)

---

<div class="post-metadata">

### Author: ![James\_Cribbs](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/james_cribbs/32/249821_2.png) [@James\_Cribbs](https://meta.discourse.org/u/James_Cribbs)
#### Post date: [5월 14, 2022, 7:20오후 UTC](https://meta.discourse.org/t/embed-discourse-in-a-native-app/110475/13 "2022-05-14T19:20:44Z")

</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: [5월 16, 2022, 1:59오전 UTC](https://meta.discourse.org/t/embed-discourse-in-a-native-app/110475/14 "2022-05-16T01:59:51Z")

</div>

이런 일은 가끔 발생합니다. 저희는 고객들을 위해 화이트라벨 앱을 몇 개 유지 관리하고 있습니다.

하지만 이 방향으로 나아가는 데 드는 비용은 엄청납니다. 연간 약 2만 달러의 예산으로 구축/유지/디버깅을 할 수 있다면, 이 방향을 고려해 보라고 말씀드리고 싶습니다.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [5월 16, 2022, 9:17오전 UTC](https://meta.discourse.org/t/embed-discourse-in-a-native-app/110475/15 "2022-05-16T09:17:33Z")

</div>

저도 최근에 비슷한 프로젝트를 진행했는데요, 네, 공개 저장소는 업데이트가 안 된 상태입니다. 도움이 필요하시면 저를 고용해 주세요.

---

<div class="post-metadata">

### Author: ![James\_Cribbs](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/james_cribbs/32/249821_2.png) [@James\_Cribbs](https://meta.discourse.org/u/James_Cribbs)
#### Post date: [5월 16, 2022, 10:25오전 UTC](https://meta.discourse.org/t/embed-discourse-in-a-native-app/110475/16 "2022-05-16T10:25:59Z")

</div>

@sam 이 프로젝트에 막 착수하려던 참인데, 주의해 달라는 말씀 감사합니다.

디스코르드 허브가 이미 이렇게 하고 있는 것 같아 기대가 컸습니다. 그런데 왜 비용이 그렇게 높을 것으로 예상하시나요? 웹뷰와 인증만 작동하게 하면 되고, 알림은 있으면 좋은 정도라고 생각했거든요. 이미 있는 앱에 추가하면 정말 멋진 기능이 될 것 같은데, 저희 팀은 웹뷰를 다뤄본 경험이 있습니다.

제가 놓치고 있는, 많은 작업이나 업데이트를 유발할 요인이 있을까요?

---

<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: [5월 17, 2022, 12:13오전 UTC](https://meta.discourse.org/t/embed-discourse-in-a-native-app/110475/17 "2022-05-17T00:13:10Z")

</div>

> [@James\_Cribbs](#):
>
> 많은 작업이나 업데이트를 유발할 수 있는, 내가 아직 예상하지 못하고 있는 부분이 있을까요?

과거에 얼마나 많은 노력이 단순한 웹 뷰 기반의 디스커스 허브에 투입되었는지 지켜본 적이 있습니다.

겉보기에는 “쉽지만”, 실제로는 1,000가지의 세부 사항들을 신경 써야 합니다.

- 하단 축소 패널
- iPhone의 곡선 처리
- 로딩 스피너
- 웹뷰의 지속적인 업데이트
- Apple의 보안 검사 및 앱 승인 과정
- 복잡한 디버깅 … 웹 사이트가 아닌 웹 뷰에서 문제가 발생하면 어떻게 될까요?

이것조차 포괄적인 목록이 아니며, @pmusaraj와 @kris.kotlarek이 20가지 이상의 추가 항목을 더 나열할 수 있을 것입니다.

앱을 제대로 만드는 것은 매우 어렵고 비용이 많이 듭니다. 요즘에는 iOS용 앱을 개발해야 할 강력한 이유가 있어야 하며, 그 과정 또한 쉽지 않습니다.

---

<div class="post-metadata">

### Author: ![dfabulich](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dfabulich/32/108716_2.png) [@dfabulich](https://meta.discourse.org/u/dfabulich)
#### Post date: [5월 17, 2022, 12:19오전 UTC](https://meta.discourse.org/t/embed-discourse-in-a-native-app/110475/18 "2022-05-17T00:19:39Z")

</div>

처음에 이 질문을 한 이유는 내 앱에 사용자를 머물게 하고 싶었기 때문입니다. Apple과 Google이 무료 트래픽을 내 앱으로 보내줄 것이라고 생각했거든요.

Android의 “Chrome Custom Tab”에서는 이 작업이 더 쉬워지거나(또는 더 어려워지거나)합니까?

WKWebView를 래핑하여 이 문제를 해결해 주는 iOS용 라이브러리를 제공해 주실 수 있을까요? (Discourse Hub를 구현하면서 이미 90% 이상의 작업을 처리하신 것 같습니다.)

---

<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: [5월 17, 2022, 12:23오전 UTC](https://meta.discourse.org/t/embed-discourse-in-a-native-app/110475/19 "2022-05-17T00:23:40Z")

</div>

> [@dfabulich](#):
>
> 안드로이드용 “Chrome Custom Tab”에서는 이 작업이 더 쉬워지나요(아니면 더 어려워지나요)?

안드로이드는 “다른” 의미로 어렵다고 할 수 있습니다. 특히 OS 자체가 원시 요소(primitives)를 제공하지 않기 때문입니다. 안드로이드에서 PWA가 이미 매우 잘 작동하는 상황에서, 거기에 투입할 노력을 정당화하기가 매우 어렵습니다.

저희는 React Native와 WKWebView를 감싸는 컴포넌트를 사용합니다. 불행히도 복잡성은 여전히 남아 있습니다. 과거의 기록을 살펴보면 React Native 업데이트를 처리하는 것도 꽤 고통스러울 수 있습니다.

---

<div class="post-metadata">

### Author: ![James\_Cribbs](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/james_cribbs/32/249821_2.png) [@James\_Cribbs](https://meta.discourse.org/u/James_Cribbs)
#### Post date: [5월 17, 2022, 10:56오전 UTC](https://meta.discourse.org/t/embed-discourse-in-a-native-app/110475/20 "2022-05-17T10:56:20Z")

</div>

@sam 이 프로젝트를 시작하게 된 이유는 실제로 푸시 알림 때문이고, 또한 기존에 이미 앱이 있어서 회원들이 같은 곳에서 여러 가지 활동(시험 공부, 커뮤니티 채팅, 쇼핑 등)을 쉽게 할 수 있기 때문입니다.

하지만 커뮤니티 앱을 PWA로 추가하도록 하면 푸시 알림과 업데이트를 받을 수 있는 것 같네요? PWA에서도 푸시 알림이 지원되나요? 업데이트: 여기에서 답변을 찾았는데, 푸시 알림을 지원하지 않는 것 같습니다.

PWA 옵션을 더 자세히 알아보고 있습니다 - 기존 네이티브 앱에 “커뮤니티 토론 참여” 링크를 추가해서, 그게 PWA를 다운로드할 수 있는 올바른 링크가 될 수도 있을 것 같습니다.

감사합니다!  
제임스

[Next page](https://meta.discourse.org/t/embed-discourse-in-a-native-app/110475.md?page=2)
