I need help making a Sign into Discord Contact us! form

I need someone to Help me
I want to Create a Contact Us! form Which requires you to Sign into Discord in order to Use However I Have Not clue how to do it I have looked up tutorials But They Are not clear enough is anyone willing to Jump on my glitch project to Help me?

I Have tried my best to do it on my Own But I just Really want Help

And because i am Sick of Reading Tutorials Do not link Tutorials Or Tell me to read The Discord Docs (they are not very Clear) Basically I want to be spoon fed or Given a Clear Tutorial It is okay To Write up a Guide and References The Sources ( i am Still learning So don’t judge me)

If you want to help Just Say so

Edit: You can also Post a very clear Guide using passport or smth i Kinda Just Need Help

Edit 2:ANYTHING IS WELCOME WEATHER IT IS SPOON-FEEDING OR A VERY CLEAR GUIDE
Also Why was My Post Flagged?

I can say already now, no one will spoon feed you. However, you can lookup passport module. That simplifies a lot of the process.

3 Likes

You need to understand that spoon feeding is not a way to learn to code.

3 Likes

For you to understand the process of using Discord’s API or Auth system. You always need to read the documentation for it. As @ihack2712 said, you can use passport and passport-discord as a middleware with express. There are no tutorials for this as far as i know. Part of programming is always reading the documentation or readme.

Thanks!

1 Like

Is there a walkthrough on How to do it? Because I don’t mind Doing one walkthrough
if it is not hard

Okay can you walk me through it Because i need Help big time

@Boofhead1000
From the npm package:

var DiscordStrategy = require('passport-discord').Strategy;
 
var scopes = ['identify', 'email'];
 
passport.use(new DiscordStrategy({
    clientID: 'id',
    clientSecret: 'secret',
    callbackURL: 'callbackURL',
    scope: scopes
},
function(accessToken, refreshToken, profile, cb) {
    User.findOrCreate({ discordId: profile.id }, function(err, user) {
        return cb(err, user);
    });
}));
app.get('/auth/discord', passport.authenticate('discord'));
app.get('/auth/discord/callback', passport.authenticate('discord', {
    failureRedirect: '/'
}), function(req, res) {
    res.redirect('/secretstuff') // Successful auth
});

Okay Walk me through what i need to Do with the code
I am learning that way


Here’s a link of a example. Hope this works for you!

The one I sent is the example. Just with simplified scopes

You’re going to need express-session and store all the data you got from the auth object into req.session so that you can make sure the user has signed in in multiple routes (sorry if this sounds complicated). And use session.destroy() to ultimately logout.

@Boofhead1000 I can show you how to that with a Google form

I am Trying to Code This All in Javascript, HTML and CSS
(the webpage i mean)

I have Added The Dependencies i think i need
I just Need to Know what To DO And Where to Put Which Piece of Code and That

Someone Write Up a Clear Walkthrough if they Know Exactly What to Do

1 Like

Okay How Do i Do That?
I may have been Doing this for a While But i am Still a Novice

May I ask, with all due respect, how is us explaining how to do something going to be any different from reading a guide or following a tutorial yourself?

Secondly, Discord oAuth is not something that can be explained with a few snippets of code, it requires understanding of the concept of sessions and general knowledge of the code itself. Also, @EddiesTech has provided more than enough code required to create a functional Discord based login. @ElectricReality has posted a link to an example Discord oAuth, which should be more than enough. You yourself said that you found many tutorials and articles on Google, why not read it and discover it yourself. That is how you learn.

Thirdly, there is a limit to everything, including spoon feeding. Asking for code snippets for something like setting a custom status for a Discord bot is okay, but asking for creating a Discord oAuth is not okay, because it can not be done with little code.

Hope you understand!

6 Likes

You simply just can’t expect anyone to spoonfeed you and use their time on re-telling you something that has probably been written down on beforehand a hundred of times. When someone sends a link to a guide, they’re probably sending a link to a guide that has been used many times and is easy to follow and understand.

I suggest you take a read on how to ask and how to write the perfect question. Asking for people to spoonfeed you is disrespectful; you’re literally asking people to waste their time writing something that has been written many times before.

If you don’t know javascript then you should learn javascript before you try to do something like this. Master the language before you master the framework.

P.S. Why was the previous post flagged? It was relative to the current discussion.

2 Likes

Sorry if i acted a Little bit of a Moron But i have Looked around QUITE a BIT And All guides or examples I have Seen have Not Worked I do not Expect Spoon Feeding But at Least a little More of a Clear Guide
I am Still Learning and Me Making a Website Is a Project I Intend to learn from So Sorry if i Acted Like a Jerk or was disrespectful

Also to answer your question:

Here is a very recent and community written guide on how to use the Discord OAuth2 flow in Node.js.

2 Likes

Ok i will have a Good Look at it and Let you know if i need a little More Help

Edit: and yet again if i come off as disrespectful or a jerk i am Sorry