Registered User
Registered User

Reputation: 2299

How to provide username password when using Restful api in java?

I have created basic authentication for a spring boot application which requires username and password.

Using it from browser works fine, with a popup asking for password

enter image description here

But how do I use it in a java application?(preferably using jackson 2 but other tools are fine). Searching online only shows about web based login pages.

Upvotes: 1

Views: 1797

Answers (1)

jp86
jp86

Reputation: 161

You need to set-up Authorization header to contain username and password in a proper Base64 encoded format to the http request you're making from the java application. Read section client side from this page for details

Upvotes: 1

Related Questions