# Discourse SSO using auth0 via URL

**URL:** https://meta.discourse.org/t/discourse-sso-using-auth0-via-url/70039
**Category:** SSO
**Created:** [14 سبتمبر 2017، 12:23م UTC](https://meta.discourse.org/t/discourse-sso-using-auth0-via-url/70039 "2017-09-14T12:23:28Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![pdias-cci](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pdias-cci/32/76197_2.png) [@pdias-cci](https://meta.discourse.org/u/pdias-cci)
#### Post date: [14 سبتمبر 2017، 12:23م UTC](https://meta.discourse.org/t/discourse-sso-using-auth0-via-url/70039/1 "2017-09-14T12:23:28Z")

</div>

I am using trying to perform SSO using Auth0 for wordPress and discourse from my own application.  
the flow is mentioned below.

 ![flow](https://global.discourse-cdn.com/meta/original/3X/2/6/26c518102c59d14a3bdc235c98c96172d9882c13.png)

The user enters user name and password in the application, the details are sent to the server which authenticates the user with the auth0 API and send back the token.

I have installed [auth0 SSO plugin](https://github.com/auth0/discourse-plugin) from GitHub in Discourse and all the client ID, client secrets are added to the plugin.

I want to know who to perform SSO in case of Discourse when I have logged into my application.

For wordPress were are using the following method.

```
    <form *ngIf="userService.isAuthenticated()" ngNoForm action="http://xx.xx.xx.xx/index.php?auth0=implicit&client_id=xxxxxxxxxxxxxxxxxxxxxxxxx&connection=xxxxxxxxxx"
        method="post">
        <input class="hidden" type="text" id="token" name="token" value="{{tokenValueIsHereReturnedbyAuth0Authentication}}" />
        <input class="hidden" type="text" id="redirect_to" name="redirect_to" value="http://xx.xx.xx.xx/index.html" />
        <input class="btn btn-primary pull-right" type="submit" value="View" />
    </form>

```

So How to do similar thing in discourse?

---

<div class="post-metadata">

### Author: ![skappala](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@skappala](https://meta.discourse.org/u/skappala)
#### Post date: [12 نوفمبر 2018، 4:44م UTC](https://meta.discourse.org/t/discourse-sso-using-auth0-via-url/70039/2 "2018-11-12T16:44:54Z")

</div>

Instead of redirecting the url, can I use GET request so that i will get the response json of user details with the user details instead of complete redirection and never returning back to the home url.

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [12 نوفمبر 2018، 5:10م UTC](https://meta.discourse.org/t/discourse-sso-using-auth0-via-url/70039/3 "2018-11-12T17:10:52Z")

</div>

If you are trying to use Auth0 and Discourse together I would recommend following this guide: [Configure sign up and log in with Auth0 using the OAuth2 Basic Plugin](https://meta.discourse.org/t/how-to-use-auth0-with-the-oauth2-basic-plugin/64633). It should allow the users to return back to the home url (or even the original url they were on) once they are logged in.

---

<div class="post-metadata">

### Author: ![skappala](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@skappala](https://meta.discourse.org/u/skappala)
#### Post date: [12 نوفمبر 2018، 5:57م UTC](https://meta.discourse.org/t/discourse-sso-using-auth0-via-url/70039/4 "2018-11-12T17:57:14Z")

</div>

Hi Blake, I’m able to login the user by redirect to url([https://my.discoursesite.com/session/sso\_login?sso&sig](https://my.discoursesite.com/session/sso_login?sso&sig)) for sso, it is logging the user landing in the discourse page but not redirecting back to my application page.  
please help me how can I get back to my application after logging in

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [12 نوفمبر 2018، 6:13م UTC](https://meta.discourse.org/t/discourse-sso-using-auth0-via-url/70039/5 "2018-11-12T18:13:42Z")

</div>

Oh you are using Discourse as the SSO provider? Are you passing in the `return_to` field specified in [Setup DiscourseConnect - Official Single-Sign-On for Discourse (sso)](https://meta.discourse.org/t/official-single-sign-on-for-discourse-sso/13045)?

---

<div class="post-metadata">

### Author: ![skappala](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@skappala](https://meta.discourse.org/u/skappala)
#### Post date: [12 نوفمبر 2018، 6:20م UTC](https://meta.discourse.org/t/discourse-sso-using-auth0-via-url/70039/6 "2018-11-12T18:20:36Z")

</div>

Our native app is the sso provider, i’m trying to create a new user if not existing in discourse based on the users existing in our application, and want to do some api calls to get the user chat topics  
I haven’t find the return\_to field in the official doc for sso..  
I’m facing cors preflight issue while accessing my.discoursesite, please suggest me how can I add the header in the docker container
