Commit 4128ebfc authored by Nicolas Mérigot's avatar Nicolas Mérigot

doc: update README

parent a9aafad7
Pipeline #2133 passed with stage
in 52 seconds
# SIB OIDC
Allows your users to login via a given OIDC provider.
Allows your users to login via a given OIDC provider.
## Installation
Add the following within the `<head>` of your HTML:
Add the following within the `<head>` of your HTML:
```html
<script src="https://cdn.happy-dev.fr/oidc-client/oidc-client.min.js"></script>
<script src="https://cdn.happy-dev.fr/sib-oidc/sib-oidc.js"
data-authority="https://some-oidc-provider.gold/openid/"
data-client_id="833925"
data-redirect_uri="http://my-app.gold"
data-response_type="id_token token"
data-scope="openid profile email"
data-automaticSilentRenew="true"
data-loadUserInfo="true"
></script>
<script type="module" src="https://unpkg.com/@startinblox/oidc@latest"></script>
<sib-auth>
<sib-auth-provider
class="sib-auth-provider"
data-authority="https://test-paris.happy-dev.fr/openid/"
data-client_id="833925"
data-id="paris"
>
</sib-auth-provider>
</sib-auth>
```
## Documentation
### bind-user
To associate the currently logged in user to a component, add the `bind-user` attribute to it.
It will set its `data-src' attribute to the currently logged in user's resource URL.
It will set its `data-src' attribute to the currently logged in user's resource URL.
**Example:**
```html
......@@ -28,10 +28,20 @@ will result in :
```html
<sib-conversation data-src="https://your-domain/your-user-uri/3" bind-user></sib-conversation>
```
### Methods available
### Access user profile via Javascript
The logged in user profile is available via the `sib.oidc.user.profile` object.
#### Login
```
document.querySelector('sib-auth').login();
```
#### Logout
```
document.querySelector('sib-auth').logout();
```
#### Get user info
```
document.querySelector('sib-auth').getUser();
```
### Configuration
See [the available properties here](https://github.com/IdentityModel/oidc-client-js/wiki#usermanager)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment