homura_left_得得B - hello i am try to use the ref...

hello i am try to use the refresh token to get another JWT , the doc said that "You can use the refresh token to query /auth/refresh and get another JWT. The refresh token is valid for 30 days." do the query here mean graphql query? the return response was "DEBUG http://localhost:17170 "GET /auth/refresh HTTP/1.1" 401 47" i got 401 in doing another python request my code was like try: headers = { 'Authorization': refesh_token, } r = session.get("http://localhost:17170/auth/refresh", headers=headers,cookies={"cookie":"123"})
response = r.json() print(f"refresh result - {response}") except Exception as err: logging.error(f"login to lldap err - {err}") return "abc"
Solution:
As I said earlier, either in a "refresh-token" header, or in a "refresh_token" cookie
Jump to solution
18 Replies
nitnelave
nitnelave15mo ago
If you enable verbose mode in LLDAP, what logs do you get when trying to send the refresh query?
homura_left_得得bb
how do i enable verbose mode ?
nitnelave
nitnelave15mo ago
Also note that the refresh token is not an Authorization header, but a refresh-token header. The Authorization header is for the actual JWT verbose=true in the config, or LLDAP_VERBOSE=true in the env, or --verbose in the CLI
homura_left_得得bb
i have also try this according to oauth spec data = { 'grant_type' : 'refresh_token',
'refresh_token' : refesh_token, "client_id": login_username, "client_secret": login_password }
r = session.get("http://localhost:17170/auth/refresh", data=data,cookies={"cookie":"123"})
nitnelave
nitnelave15mo ago
The cookie is not needed (you can actually pass the refresh token as a refresh_token cookie if you want) It's not OAuth, so it won't help 🙂 Also, GET queries shouldn't have data
homura_left_得得bb
but post get 405.., thats why i use get
nitnelave
nitnelave15mo ago
Right, but that just means the query doesn't accept data
homura_left_得得bb
i still figure out how to set to verbose mode, my docker command was docker run -p 17170:17170 -p 3890:3890 -v /home/user/Jeff/Software/dev_project/lldap/lldap_data:/data nitnelave/lldap
nitnelave
nitnelave15mo ago
You can check how to set environment variables for docker run here: https://docs.docker.com/engine/reference/commandline/run/
Docker Documentation
docker run
Learn all there is to know about the docker run command and how to use it in the Docker CLI.
homura_left_得得bb
cat lldapconfig.toml `## Default configuration for Docker. All the values can be overridden through environment variables, prefixed with "LLDAP". For instance, "ldap_port" can be overridden with the "LLDAP_LDAP_PORT" variable. Tune the logging to be more verbose by setting this to be true. You can set it with the LLDAP_VERBOSE environment variable." verbose=true` i already have it enabled but it seems have nothing return in the log
nitnelave
nitnelave15mo ago
When quoting code/logs, make sure to wrap it in triple back-quotes: "``" My guess is that your docker run command doesn't put the config file in a place that LLDAP can find it. I would either recommend to use docker compose (there's an example in the readme) or if you still want to use docker run, use environment variables to set the verbose mode
homura_left_得得bb
HTTP request [ 12.9µs | 100.00% ] method: "POST" | uri: "/auth/refresh" 2023-10-13T09:58:14.560054474+00:00 DEBUG ┕━ 🐛 [debug]: | status_code: 405
homura_left_得得bb
` data = { 'grant_type' : 'refresh_token',
'refresh_token' : refesh_token,
}
r = session.post("http://localhost:17170/auth/refresh", data=data,cookies={"cookie":"123"})
` i have try refresh-token is not accepted,
nitnelave
nitnelave15mo ago
As we talked about earlier, it should be a get, and without data
homura_left_得得bb
ok where should i pass the refresh token?
Solution
nitnelave
nitnelave15mo ago
As I said earlier, either in a "refresh-token" header, or in a "refresh_token" cookie
homura_left_得得bb
thanks you!
Want results from more Discord servers?
Add your server