According to the 
documentation: 
https://github.com/DSpace/RestContract/blob/main/authentication.md
this endpoint ONLY accepts the POST http method, to get the 
DSPACE-XSRF-TOKEN you can make a GET on /server/api/authn/status and then 
make the POST, here is a snippet written in scala I use to authenticate:


val responseStatus: Response[String] = quickRequest
.get(uri"http://localhost:8080/server/api/authn/status";)
.send()
val dspaceXsrfToken: String = responseStatus.header("dspace-xsrf-token"
).getOrElse("")
val responseLogin = quickRequest
.post(uri"http://localhost:8080/server/api/authn/login";)
.cookie("DSPACE-XSRF-COOKIE", dspaceXsrfToken)
.header("X-XSRF-TOKEN", dspaceXsrfToken)
.body(Map("user" -> user, "password" -> pass)) 
.send()

Em sábado, 26 de agosto de 2023 às 07:34:47 UTC-4, badak afrika escreveu:

> I'm working on an assignment related to Dspace. When I use the endpoint 
> for login it returns error code 405 with the words "Only POST is allowed 
> for login requests" even though a few weeks ago this endpoint was running 
> normally. This login endpoint returns AWSLAB and AWSALBCORS which 
> previously returned DSPACE-XSRF-TOKEN values. What happened to this login 
> endpoint and how can I login through the endpoint?
>

-- 
All messages to this mailing list should adhere to the Code of Conduct: 
https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx
--- 
You received this message because you are subscribed to the Google Groups 
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dspace-tech+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dspace-tech/81be5e70-6b89-45a7-9fc5-690aa13bdbb8n%40googlegroups.com.
  • [dspace-tech] Lo... badak afrika
    • [dspace-tec... 'FREDERICO FERRÃO DA SILVA' via DSpace Technical Support

Reply via email to