mirror of
https://github.com/lldap/lldap.git
synced 2026-04-26 00:36:01 +03:00
[GH-ISSUE #375] Is there any documents for get token for graphql programmatically? #143
Labels
No labels
backend
blocked
bug
cleanup
dependencies
docker
documentation
duplicate
enhancement
enhancement
frontend
github_actions
good first issue
help wanted
help wanted
integration
invalid
ldap
pull-request
question
rust
rust
tests
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/lldap-lldap#143
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @leopku on GitHub (Nov 23, 2022).
Original GitHub issue: https://github.com/lldap/lldap/issues/375
I wanna write some app backend with lldap but troubled with how to get token to access graphql endpoint.
Any advice?
@nitnelave commented on GitHub (Nov 23, 2022):
Hmm, the doc is definitely missing. Unless you're writing your app in Rust (in which case you can use the
lldap_authcrate, and I might have to publish it), it's going to be hard to use the OPAQUE protocol to log in (not stabilized yet, and we use a somewhat old version).Thankfully, there's a more classical way forward: You can send a json POST request to
/auth/simple/loginwith{"username": "john", "password": "1234"}in the body.In the response, you'll have 2 http-only cookies (the JWT and the refresh token, valid longer), and they will also be in the response. The JWT is valid for a day, but within 30 days you can just call
/auth/refreshand the refresh cookie will be enough to identify you.The JWT is then used for identifying other requests, either through a cookie or through a Bearer Authorization header.
@leopku commented on GitHub (Nov 23, 2022):
@nitnelave Your reply really help me. Thanks a lot.
@nitnelave commented on GitHub (Nov 23, 2022):
I'm looking forward to your app, I hope you'll share it!
If you want to write the authentication part in a doc somewhere, that would be helpful.
Also, BTW: I'm working on a somewhat big feature (https://github.com/nitnelave/lldap/issues/67) that'll change the API, including extending GraphQL. It'll be backwards-compatible, but you might be interested in supporting it once it's released (not quite for right now though).
@leopku commented on GitHub (Dec 4, 2022):
My app not start yet.
I can write and share a small demo app for your advise.