# SIB OIDC
Allows your users to login via a given OIDC provider.
## Installation
Add the following within the `<head>` of your HTML:
```html
  <script type="module" src="https://cdn.skypack.dev/@startinblox/oidc@beta/dist/index.js"></script>
  <sib-auth>
    <sib-auth-provider
      data-authority="https://api.community.startinblox.com"
      data-id="sib"
      data-client-name="Hubl SIB"
    ></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.

**Example:**
```html
<sib-conversation
  bind-user
></sib-conversation>
```
will result in :
```html
<sib-conversation
  data-src="https://your-domain/your-user-uri"
  bind-user
></sib-conversation>
```
### Methods available

#### Login
```js
document.querySelector('sib-auth').login();
```
#### Logout
```js
document.querySelector('sib-auth').logout();
```
#### Get user info
```js
document.querySelector('sib-auth').getUser();
```

