# Using custom authentication

**URL:** https://meta.discourse.org/t/using-custom-authentication/182536
**Category:** Development
**Created:** [March 8, 2021, 7:03pm UTC](https://meta.discourse.org/t/using-custom-authentication/182536 "2021-03-08T19:03:00Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![cb-candor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cb-candor/32/212467_2.png) [@cb-candor](https://meta.discourse.org/u/cb-candor)
#### Post date: [March 8, 2021, 7:03pm UTC](https://meta.discourse.org/t/using-custom-authentication/182536/1 "2021-03-08T19:03:00Z")

</div>

Hey everyone 👋,

Currently trying to integrate with our own website’s cookie-based authentication. We have a callback URL that we typically pass various parameters to authenticate users - however we’re experiencing trouble trying to authenticate users in Discourse in the same way.

I’ve been playing around with ([GitHub - discourse/discourse-oauth2-basic: A basic OAuth2 plugin for use with Discourse · GitHub](https://github.com/discourse/discourse-oauth2-basic)) but it’s proving difficult to integrate with our setup.

Is there any way to configure how Discourse authenticates users so we can use our own methods? Happy to supply any supplementary information or code if needed, any advice is appreciated!

---

<div class="post-metadata">

### Author: ![Alexander](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alexander/32/497634_2.png) [@Alexander](https://meta.discourse.org/u/Alexander)
#### Post date: [March 8, 2021, 7:09pm UTC](https://meta.discourse.org/t/using-custom-authentication/182536/2 "2021-03-08T19:09:42Z")

</div>

Hi, welcome to Meta! 😀

This varies a lot depending on how you created your authentication system.

Could you explain how it works or pass a URL to your site?

---

<div class="post-metadata">

### Author: ![cb-candor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cb-candor/32/212467_2.png) [@cb-candor](https://meta.discourse.org/u/cb-candor)
#### Post date: [March 8, 2021, 7:21pm UTC](https://meta.discourse.org/t/using-custom-authentication/182536/3 "2021-03-08T19:21:20Z")

</div>

Hey Alexander - the way it currently works is as follows:

1. The user enters an email, receives a magic link with various URL parameters (user id, timestamp, hash w. secret for authenticating session) that leads to a callback URL on our end.
2. After the callback function authenticates the user, a cookie is created and a session is created in the database.

It’s a relatively straightforward setup, but not super compatible with OAuth2 plugins.

---

<div class="post-metadata">

### Author: ![stanislav-modrak](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stanislav-modrak/32/463407_2.png) [@stanislav-modrak](https://meta.discourse.org/u/stanislav-modrak)
#### Post date: [November 11, 2024, 11:33am UTC](https://meta.discourse.org/t/using-custom-authentication/182536/4 "2024-11-11T11:33:35Z")

</div>

Hi @cb-candor, how did you solve this? We’re pursuing an identical use case. Alternatively, @Alexander, able to provide any advice?
