C
C#•3y ago
Heartbeat1

minimal api create own authorisation?

Hey Everyone, i am still struggeling with my Project (simple Console App - Minimal Web Api - discord Authentication). So right now my Console app can fullfill the complete auth process to discord so i got the Access token in the console app, but what i didnt now before that the normal providers that i found didnt verify that token. so i am thinking of get a new api endpoint where i send my access token, proof the data in an seperate class and save all the data in an sql table. Then the next step would be that the api calls this database at every call to check if that token is correct and so on( so the authorization Process?) Is that something that's doable? Is there some Information to create an own auth process? Or is that an really bad way and i should try something else? Thanks for you help
9 Replies
Mkp
Mkp•3y ago
Do you are using web api raw?
Heartbeat1
Heartbeat1OP•3y ago
i am not sure what you mean 😉
Heartbeat1
Heartbeat1OP•3y ago
ahh i used the oauth2 token in my local app and send the data with the access tokken to the api
Mkp
Mkp•3y ago
Although its in JS I grinded a lot of hours coming up with this, https://pastebin.com/4p0VQ760 I hope it helps Keep in mind you have to refresh your token or else it will expire And api calls to the web api have a very specific format thats detailed in discords docs, its send exactly like verify(); with different json parameters. And as a bonus (because the api itself wont get you far if dealing with a discord server) here is the gateway api being used https://pastebin.com/zcvBbubx for bots and the like
Heartbeat1
Heartbeat1OP•3y ago
okay thanks i will look into this
Mkp
Mkp•3y ago
I'll keep this followed if you have any questions
Heartbeat1
Heartbeat1OP•3y ago
sry for the late response but was struggeling with other stuff at the moment 😉 But i think there is an missunderstanding. In my Local app the complete oauth login works and i got the access token in local app. My question is more if i send this to my webapi can i custom validate this access token which is in the header. i think i can do this with an jwt authentication but i am not sure 😉
Mkp
Mkp•3y ago
You have to communicate with discord from the same socket
Want results from more Discord servers?
Add your server