import oidcClient from '@muze-nl/oidc-client'
async function main() {
const client = new oidcClient()
try {
const session = await client.signIn('https://solidcommunity.net/')
if (session.isAuthenticated()) {
const file = await session.get(fileURL) // fill this in
await session.signOut()
}
} catch(err) {
alert(err)
}
}
npm i @muze-nl/oidc-client
Or use a CDN:
<script src="https://cdn.jsdelivr.net/npm/@muze-nl/oidc-client/dist/browser.min.js"></script>
The oidcClient
extends the metro
client, so it supports all the things that metro does, including middleware.
Read more about metro here
It also uses the metro-oidc
middleware, any options you want to pass
on to that, you must pass on in the .oidc
options property in the constructor, like this:
import oidcClient from '@muze-nl/oidc-client'
const client = new oidcClient({
oidc: {
client_info: {
client_name: 'My oidc client'
}
}
})