Skip to content

Commit

Permalink
Merge pull request #556 from ThisIsMissEm/patch-1
Browse files Browse the repository at this point in the history
Simplify example code showing setting solidFetcher
  • Loading branch information
jeff-zucker authored May 12, 2022
2 parents cd56ba2 + 4d03633 commit c14dfd5
Showing 1 changed file with 9 additions and 8 deletions.
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 @@ [email protected]/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 @@ [email protected]/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

0 comments on commit c14dfd5

Please sign in to comment.