Hope you are all doing well.
I built one discourse forum and tried to connect with my Web site(ASP.NET).
First, I used Discourse-Connect and success, however, with it users can’t log in and sign up in forum.
so, I tried use Discourse-Api to log in to forum, but not completed.
I read many documentations but didn’t find correct solution.
Plz Anyone help me to solve this issue or tell me possibility, correct solution.
You have two possibilities:
Set up DiscourseConnect so users will sign up and log in to your website, and when they try to log in to your forum it will be automatically. This is the usual setup. If you configure things like this then all registration and log in will be at your website. The username/password log in and registration on your forum will be disabled.
Set up DiscourseConnect so users will sign up and log in to your forum, and when they try to log in to your website(s) it will be automatically. This is called setting up Discourse as the DiscourseConnect Provider and how to do that can be found here.
Thanks for your fast response.
Is there any possibilities without DiscourseConnect?
Why don’t you want to use it?
Of course you can implement something yourself but you will throw away years of experience that has been put into building DiscourseConnect. So before you decide to undertake that huge task you must decide what good reason you have to build something yourself instead of using what is already available.
Of course, I know DiscourseConnect is excellent feature.
But my purpose is local login and sign up on Discourse Forum.
So I tried to use Discourse API.
Isn’t there possibilities with Discourse API?
Ok, if you want to do a local login and sign up on Discourse, then please tell me what kind of integration with your website you are looking for.
My purpose is to like this:
1)If user logined to mysite, when go to forum, user automatically log in forum.
2)And user can log in and sign up in forum.
3)If user logined to forum, when go to mysite, user automatically log in mysite.
With DiscourseConnect, I can perform 1), 3), but can’t perform 2).
but 2) is very important for us.
If you allow users to register in two places, things will quickly become a mess, and that is why you have to make a choice, either users register on your website or users register on your forum, but not both.
Why is this so important for you?
Thanks for your help.
However, My boss wants it.
Please check my perform.
I tried to perform with Discourse API like this
- call GET ‘/session/csrf’ and get csrf token and cookie
- call POST ‘/session’ with Header:‘X-CSRF-Token’=‘csrf token’, ‘Cookie’ = ‘obtained cookie’, Data: login, password, timezone, second-factor-method,authenticity-token
- call POST ‘/login’ with Header: ‘Cookie’=‘obtained cookie from /session’
Data: username, password, redirect
All logs are same with Discourse Login workflow.
But when I redirect to discourse forum, user didn’t log in.
How can I solve this issue? What wrong?
Thanks for your help again.
PS. My Server is Ubuntu Nginx Server.
Then you need to explain to your boss that having users register at more than one place is a very bad idea. Things will become a huge mess. Explain him what happens when you register at the website with usernameA and at the forum with usernameB, with the same email address! Or what would happen if the user changes their password only on the website, or only on Discourse. Then things will break!
What you have done logs your SERVER into the forum as the user. It will not set the session cookies for the user, so it will not log the user into the forum.
Additionally, you apparently have the plain text password for the user to your disposal. This is a VERY BAD idea. You should always store a hash (one-way encryption) of a password, and never the plain text password. When your database gets hacked, all the passwords of your users will be known to the attacker. Another good thing to explain to your boss.
I have given you three good reasons that you can use to convince your boss to do things differently. This will only lead to huge problems. I cannot help you with getting this to work, because it will not work. Even if you get it to work it will only work in the short run.
I will explain to my boss about These.
Thanks a lot.
I want to discuss more with you(of course not about this).
Plz help me one more.
My Forum server has one main domain and several subdomains.
Can I build several discourse forums on each domains using one database?
And Can I build like this?:
-On Main Domain, possible to local login and signup.
-On Sub domains, with DiscourseConnect, connect to my sites.
If possible, Please guide me to build.
If impossible, Please tell me the reason.