LuckPerms / rest-api

A REST API for LuckPerms.
MIT License
31 stars 8 forks source link

Authentication as LuckPerms extension #7

Open Timtendo12 opened 1 year ago

Timtendo12 commented 1 year ago

Hi!

I can't seem to be able to get the authentication working. I tried adding this to the startup command:

java -DLUCKPERMS_REST_AUTH=true -DLUCKPERMS_REST_AUTH_KEYS=<authkey> ..(rest of my startup command line)

I even have them setup as a env variable using the "export" command on my linux server but I keep getting the error:

{
    "error": "You are not authorized to access this endpoint."
}
lucko commented 1 year ago

Try:

java -Dluckperms.rest.auth=true -Dluckperms.rest.auth.keys=<authkey> ..(rest of my startup command line)

and then make HTTP requests with the following header

Authorization: Bearer <authkey>

If that doesn't work, please give more detailed reproduction steps and I can have a deeper look. :)

Timtendo12 commented 1 year ago

Hmm, It still does not seem to be able to authenticate:

How to reproduce:

Running as a LuckPerms extension on Velocity

My full startup command:

java -Dluckperms.rest.auth=true -Dluckperms.rest.auth.keys=Q8LZlntXcPwS2nhnbgqqFRafH0zVna12 -Xms128M -Xmx{{SERVER_MEMORY}}M -XX:+UseG1GC -XX:G1HeapRegionSize=4M -XX:+UnlockExperimentalVMOptions -XX:+ParallelRefProcEnabled -XX:+AlwaysPreTouch -XX:MaxInlineLevel=15 -jar {{SERVER_JARFILE}}

Luckperms startup log: https://hastebin.com/share/ipunabuqic.markdown

Postman settings: image

lucko commented 1 year ago

That error does not look like it's coming from LuckPerms

Timtendo12 commented 1 year ago

Hmm weird, I'll continue troubleshooting... However, if I don't get it to work you think I could hardcode the credentials into the jar?