I want to embed a username with spaces in the URL for basic authentication.

Asked 2 years ago, Updated 2 years ago, 89 views

Embedding username and password into URL for basic authentication is as follows and
I understand.

http://username:[email protected]

For example, if your username and password contain spaces or symbols, you can encode them as a percentage. I embedded it in the URL, but I can't log in.

Example
username —AAA bbb01
password:DddEeeee11!

http://AAA%20bb%2001:DddEee11%[email protected]

Is the URL wrong?

html http

2022-09-29 21:32

1 Answers

There should be no problem encoding the URL as a percentage.

It is the role of the client (browser) to extract login information from the URL and set it in the Authorization header.You should check the log to see if your client interprets the URL correctly.If interpreted correctly, the request should be as follows:

GET/HTTP/1.1
...
Authorization: Basic Zm9vIGJhcjpiYXp6IQ==


2022-09-29 21:32

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.