Skip to content
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

Simplify example code showing setting solidFetcher #556

Merged
merged 2 commits into from
May 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions Documentation/alternate-fetches.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ r@1.11.2/dist/solid-client-authn.bundle.js"></script>
<script>
const idp = "https://solidcommunity.net";
const privateResource = "https://jeff-zucker.solidcommunity.net/private/";
const auth = solidClientAuthentication;
async function main(session){
const kb = $rdf.graph();
window.solidFetcher = session.fetch;

// Set the fetcher:
window.solidFetcher = solidClientAuthentication.fetch;

async function main(){
const kb = $rdf.graph();
const fetcher = $rdf.fetcher(kb)
try {
await fetcher.load(privateResource);
Expand All @@ -56,16 +58,15 @@ r@1.11.2/dist/solid-client-authn.bundle.js"></script>
catch(e) { alert(e) }
}
document.getElementById('login').onclick = ()=> {
auth.login({
solidClientAuthentication.login({
oidcIssuer: idp,
redirectUrl: window.location.href,
clientName: "rdflib test"
});
}
async function handleRedirectAfterLogin() {
await auth.handleIncomingRedirect();
session = auth.getDefaultSession();
if (session.info.isLoggedIn) main(session);
const session = await solidClientAuthentication.handleIncomingRedirect();
if (session.info.isLoggedIn) main();
}
handleRedirectAfterLogin();
</script></html>
Expand Down