Url auth using is username and password but both have a @ in have trie encoding still getting error

I need to auth my url ,send a username and password with it. What do you do if the username is youre email and youre password contains an @ aswell. Is there another method in doing this

I have tried window.open(“https://name:password@url”); and tried encoding everythin but get a string error, any siggesstions