# Authorize REST request if @ is in username

**URL:** https://discourse.julialang.org/t/authorize-rest-request-if-is-in-username/5869
**Category:** General Usage
**Tags:** question, packages
**Created:** [September 13, 2017, 12:19pm UTC](https://discourse.julialang.org/t/authorize-rest-request-if-is-in-username/5869 "2017-09-13T12:19:18Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![antoperit](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@antoperit](https://discourse.julialang.org/u/antoperit)
#### Post date: [September 13, 2017, 12:19pm UTC](https://discourse.julialang.org/t/authorize-rest-request-if-is-in-username/5869/1 "2017-09-13T12:19:18Z")

</div>

Using `post` function from package Requests I have to authorize the communication.  
I follow recommendation in [Requests.jl](https://github.com/JuliaWeb/Requests.jl)

> post(“[http://username:password@httpbin.org/post](http://username:password@httpbin.org/post)”)

However I have to use username in the form of e-mail address.

> post( “[https://test@test.com](https://test@test.com):passwd@httpbin.org/post”)

Then I get response

> Port must be numeric (decimal)

Can you advise how to authorize username in form of an e-mail address, please ?

---

<div class="post-metadata">

### Author: ![quinnj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/quinnj/32/11_2.png) [@quinnj](https://discourse.julialang.org/u/quinnj)
#### Post date: [September 13, 2017, 1:09pm UTC](https://discourse.julialang.org/t/authorize-rest-request-if-is-in-username/5869/2 "2017-09-13T13:09:20Z")

</div>

Because the username/password are in the “host” part of the url, they need to be URL-encoded (since the set of allowed characters for hosts is extremely restricted). So the following works for me:

```julia
HTTP.post("https://" * HTTP.escape("test@test.com:passwd") * "@httpbin.org")

```

That’s perhaps something a package like `HTTP.jl` could detect automatically though, so I created [an issue](https://github.com/JuliaWeb/HTTP.jl/issues/90) to look into it.

---

<div class="post-metadata">

### Author: ![antoperit](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@antoperit](https://discourse.julialang.org/u/antoperit)
#### Post date: [September 20, 2017, 2:20pm UTC](https://discourse.julialang.org/t/authorize-rest-request-if-is-in-username/5869/3 "2017-09-20T14:20:01Z")

</div>

quimmj kindly thank you for the answer.
