# Discourse login from external site

**URL:** https://meta.discourse.org/t/discourse-login-from-external-site/251263
**Category:** SSO
**Created:** [January 10, 2023, 10:02am UTC](https://meta.discourse.org/t/discourse-login-from-external-site/251263 "2023-01-10T10:02:28Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Yash\_Sharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/yash_sharma/32/287223_2.png) [@Yash\_Sharma](https://meta.discourse.org/u/Yash_Sharma)
#### Post date: [January 10, 2023, 10:02am UTC](https://meta.discourse.org/t/discourse-login-from-external-site/251263/1 "2023-01-10T10:02:29Z")

</div>

Hey, we had a use case where we need to integrate discourse in current product (Next js app). We are looking to build a community using discourse APIs. We are facing an issue with the login flow.

More context: The product’s webapp uses google login let’s say [example.com](http://example.com). Discourse forum is self hosted on [discourse.example.com](http://discourse.example.com). As its a single page application we would like to have dynamic authentication to discourse, based on the exploration we did, this is not possible. We looked at how [discourseConnect](https://meta.discourse.org/t/13045?silent=true) works and have created a small prototype to understand the overall flow. The problem with [discourse connect](https://meta.discourse.org/t/13045?silent=true) is that, it redirects to [discourse.example.com](http://discourse.example.com).

Question is: How would we login a user in discourse to call authenticated APIs from our SPA?
