-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deno run with basic authentication #5897
Comments
Yes we should support this. Not a high priority for me, but I'd be happy to lend some guidance to anyone who wanted to add this. |
Hi @ry I can work on this, please let me know where to start. |
Would you then expect that imports also contain username/pass? Or would the username/pass from the root script magically apply to all imports with the same host (quasi "logged in")? Or would it work only for single-file scripts? #1 and #2 seem pretty weird to me. #3 seems clean, though not sure if still useful to people. |
For imports, especially as basic authentication isn't available all the time, think local urls, it seems like a decent idea to add a cli option for this, or preferably a path to a file with credentials similar to |
Looks like Deno's underlying HTTP client reqwest already allows basic authentication. In the method to fetch remote source pub fn fetch_once(
client: Client,
url: &Url, // url: http://user:pass@52.90.21.56/welcome.ts
cached_etag: Option<String>,
) -> ... {
...
let mut request = client.get(url.clone());
// request: RequestBuilder { method: GET, url: "http://52.90.21.56/welcome.ts", headers: {"authorization": "Basic dXNlcjpwYXNz"} }
...
} Username and password are automatically extracted from URL and set to header. I put up a simple basic auth example, try this:
import * as script from "http://user:pass@52.90.21.56/welcome.ts";
script; |
I have to apologize. I was using |
If you're going to make an implementation, please consider this suggestion: #5239 (comment) Would be absolutely cool to hear feedback from Ryan (I suspect he loves |
This is now supported using |
Please support basic authentication for "deno run" like
The text was updated successfully, but these errors were encountered: