Test my Spring Boot endpoints with curl
I'm learning Spring Boot and I want to test my endpoints using curl, but I have a problem: I can't because returns me 401 code, possibly I need a basic authentication (curl username and password). How can set it up in curl and in my Spring Boot project?
11 Replies
⌛ This post has been reserved for your question.
Hey @Franscis123$#! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./closeor theClose Postbutton above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
do you already have authentication set up in spring
or you dont have any at all
No. I don't have any authentication.
also a better option would be to use postman btw
looks way better
anyway
is your application on your local machine
show the endpoint
and the response
Yeah, is in local.
do you have spring security added
i dont mean any code
just the dependency
Yeah
if you remove the dependency its gonna work
but
if you want to keep the dependency
you need to setup the endpoints
sooooo
if you choose the latter
make a class named
SecurityConfig
and paste this
and then when you launch the application it will work
that might or might not work depending on your spring security version but for the new ones will work
Thanks! Now it works and create the register in the DB as expected
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Post Closed
This post has been closed by <@1117467821270650921>.