C
C#•2y 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•2y ago
Do you are using web api raw?
Heartbeat1
Heartbeat1•2y ago
i am not sure what you mean 😉
Heartbeat1
Heartbeat1•2y ago
ahh i used the oauth2 token in my local app and send the data with the access tokken to the api
MKP
MKP•2y 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
Heartbeat1•2y ago
okay thanks i will look into this
MKP
MKP•2y ago
I'll keep this followed if you have any questions
Heartbeat1
Heartbeat1•2y 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•2y ago
You have to communicate with discord from the same socket