Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

URL: Username with @

People also ask

What is URL username?

username. The username property of the URL interface is a string containing the username specified before the domain name. Note: This feature is available in Web Workers.

How do you add a username to a URL?

We can do HTTP basic authentication URL with @ in password. We have to pass the credentials appended with the URL. The username and password must be added with the format − https://username:password@URL. Let us make an attempt to handle the below browser authentication.

How do I add a username and password to a URL?

1 Answer. It is indeed not possible to pass the username and password via query parameters in standard HTTP auth. Instead, you use a special URL format, like this: http://username:[email protected]/ -- this sends the credentials in the standard HTTP "Authorization" header.

Can a URL contain special characters?

A URL is composed of a limited set of characters belonging to the US-ASCII character set. These characters include digits (0-9), letters(A-Z, a-z), and a few special characters ( "-" , "." , "_" , "~" ). When these characters are not used in their special role inside a URL, they must be encoded.


You need to URL encode the @ as %40.


Use %40 in your username instead of the @ symbol for the url encoding. It should pass it properly then.


Just do:

 http://my_email%40gmail.com:[email protected]_site.com

I am quite surprised that problem was with username @ and not the password -usually this is where I get reserved characters in url authority or path parts.

To solve general case of special characters: Just open chrome console with F12 then paste encodeURIComponent(str) where str is your password (or username) and then use the encoded result to form url with password.

Hope this saves you some time.