-
You may not be able to help me with this so please feel free to disregard. There are many ways to authenticate using Kulala, but I'm having a difficult time wrapping my head around authenticating with a Laravel application that uses basic browser based authentication. I can't simply send a request to |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 12 replies
-
Browser based auth can be implemented in a number of ways - through a form with login/password that gets sent with a POST request or request that sends the credentials in the Authorizaton header of the request, like Basic/Digets Auth. |
Beta Was this translation helpful? Give feedback.
-
### Login_page
GET localhost:8000/login
> {%
-- lua
client.global.token = vim.uri_decode(response.cookies["XSRF-TOKEN"].value)
%}
###
run #Login_page
POST localhost:8000/login
Content-Type: application/json
X-Xsrf-Token: {{token}}
Cookie: XSRF-TOKEN={{Login_page.response.cookies.XSRF-TOKEN.value}}
Cookie: laravel_session={{Login_page.response.cookies.laravel_session.value}}
Referer: http://localhost:8000/login
{
"email": "[email protected]",
"password": "pass",
"remember": false
}
|
Beta Was this translation helpful? Give feedback.
-
You should be also getting an error Better do this: ### Acquire_XSRF_TOKEN
GET localhost:8000/login
> {%
-- lua
client.global.token = response.cookies["XSRF-TOKEN"].value
client.global.decoded_token = vim.uri_decode(client.global.token)
client.global.session = response.cookies["laravel_session"].value
%}
### Authentication
run #Acquire_XSRF_TOKEN
POST localhost:8000/login
Content-Type: application/json
X-Xsrf-Token: {{decoded_token}}
Cookie: XSRF-TOKEN={{token}}
Cookie: laravel_session={{session}}
Referer: http://localhost:8000/login
{
"email": "[email protected]",
"password": "passpass"
}
> {%
-- lua
-- save the new set authenticated session
client.global.session = response.cookies["laravel_session"].value
%}
### Dashboard
run #Acquire_XSRF_TOKEN
run #Authentication
GET http://localhost:8000/dashboard
Cookie: laravel_session={{session}} this way, with You can now run the |
Beta Was this translation helpful? Give feedback.
You are simply awesome man. Thank you so much.