Login Endpoint

46 views
Skip to first unread message

badak afrika

unread,
Aug 26, 2023, 7:34:47 AM8/26/23
to DSpace Technical Support
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?

FREDERICO FERRÃO DA SILVA

unread,
Aug 28, 2023, 10:36:14 AM8/28/23
to DSpace Technical Support
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
.send()
val dspaceXsrfToken: String = responseStatus.header("dspace-xsrf-token").getOrElse("")
val responseLogin = quickRequest
.cookie("DSPACE-XSRF-COOKIE", dspaceXsrfToken)
.header("X-XSRF-TOKEN", dspaceXsrfToken)
.body(Map("user" -> user, "password" -> pass))
.send()
Reply all
Reply to author
Forward
0 new messages