William Pham
William Pham

Reputation: 291

Having "@" in username in credentials URL Basic authentication

I'm trying to use Stripe webhook to call an API for pushing events to that API. And as in my understanding stripe has a way of adding basic authentication for webhooks by using https://{username}:{password}@myAPI.com which will then base64 encode Username and Password as Basic {based64encodedToken} to the endpoint https://myAPI.com

However, the username for basic authentication contains "@" in it, for example: user1@myapp-1awjn. Which will then mess up the API. Does anybody know how to escape it?

Upvotes: 0

Views: 372

Answers (1)

Nolan H
Nolan H

Reputation: 7459

What you describe is not a valid form of userinfo within the authority portion of a URI according to the spec.

The user information, if present, is followed by a commercial at-sign ("@") that delimits it from the host.

If you need this, you'll need to URL encode the @ and parse within your system, eg https://user%[email protected]/

Upvotes: 1

Related Questions