Can't access private resource
pheyvaer opened this issue · 3 comments
pheyvaer commented
I'm logged in as https://pheyvaer.inrupt.net/profile/card#me
. I have access to https://pheyvaer.inrupt.net/private/data.txt
when I open the link in the browser. However, when executing the following code I get an HTML response stating that I don't have access (see below):
<script src="https://solid.github.io/solid-auth-client/dist/solid-auth-client.bundle.js"></script>
<script>
solid.auth.trackSession(async session => {
if (!session) {
console.log('The user is not logged in');
} else {
console.log(`The user is ${session.webId}`);
const response = await solid.auth.fetch('https://pheyvaer.inrupt.net/private/data.txt');
console.log(await response.text());
}
});
</script>
The response is
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>No permission</title>
<link rel="stylesheet" href="/common/css/bootstrap.min.css">
<link rel="stylesheet" href="/common/css/solid.css">
</head>
<body>
<div class="container">
<div class="page-header">
<h1>No permission to access this resource</h1>
</div>
<div class="alert alert-danger">
<p>
You are currently logged in as <code>https://pheyvaer.inrupt.net/profile/card#me</code>,
but do not have permission to access <code>https://pheyvaer.inrupt.net/private/data.txt</code>.
</p>
<p>
<button id="logout" type="button" class="btn btn-danger">Log out</button>
</p>
</div>
</div>
</div>
<script src="/common/js/solid-auth-client.bundle.js"></script>
<script src="/common/js/auth-buttons.js"></script>
</body>
</html>
So I'm logged in, but I don't have access, while I should have.
jaxoncreed commented
Could you copy the curl for the request that returns the "no permission found" page?
You can follow these instructions to do so: https://ec.haxx.se/usingcurl-copyas.html
pheyvaer commented
curl 'https://pheyvaer.inrupt.net/private/data.txt' -H 'Connection: keep-alive' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' -H 'authorization: Bearer eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiIyMGZkYWY4NmFmMDlkNWQ2ODZiYmQ3MzU1MjhlZjVkNyIsImF1ZCI6Imh0dHBzOi8vcGhleXZhZXIuaW5ydXB0Lm5ldCIsImV4cCI6MTU3NDE3NTk1NiwiaWF0IjoxNTc0MTcyMzU2LCJpZF90b2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OOzK0DLFqDDVhr0MeB8rQ79ZkWQVzu65fAvy-EkZAQa3iIM6io7yxcwNVGcewB_j5WPSetWQ' -H 'Origin: http://localhost:8080' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36' -H 'Accept: */*' -H 'Sec-Fetch-Site: cross-site' -H 'Sec-Fetch-Mode: cors' -H 'Referer: http://localhost:8080/bug' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: en-US,en;q=0.9' -H 'Cookie: nssidp.sid=s%3AzxnnHfuwjW2a83MJUkBvvO-OBaox9MDD.ofF1t32DGikokCOc5L7Y85TKw735HRQwGwF%2FmkD1MNg' --compressed
jaxoncreed commented