-
Hi I have been trying to make a request to my deno server like this
and I am failing to pick up the username, password or hash, has anyone been able to successfully get this right if so how and I can please be directed to the correct place |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
hashThe URL hash value is not sent to the server. Therefore, it is not possible to retrieve the hash value on the server side. username and passwordUsername and password information is in the import { serve } from "https://deno.land/std@0.170.0/http/mod.ts";
serve((req) => {
console.log(req.url);
console.log(req.headers.get("authorization")); // => "Basic dXNlcjpwYXNz"
return Response.json({ ok: true });
}); > curl http://user:pass@localhost:8000/ Perhaps this code will be helpful.↓ |
Beta Was this translation helpful? Give feedback.
hash
The URL hash value is not sent to the server. Therefore, it is not possible to retrieve the hash value on the server side.
(ref: https://stackoverflow.com/a/317769)
username and password
Username and password information is in the
authorization
header. This value is the Base64 encoding of ID and password joined by a single colon.> curl http://user:pass@localhost:8000/
Perhaps this code will be helpful.↓
https://deno.land/x/basic_auth@v1.1.1/mod.ts?source#L36