# User authorization callbacks

You can provide a function to be called after user succesful user authorization in widget.

```
closer.init({
  orgId: "00000000-0000-0000-0000-000000000000",
  onUserAuthorizationSuccess: (authorizationResult: UserAuthorizationResult) => console.log("USER AUTHORIZED")
});
```

Authorization result object:

```
interface UserAuthorizationResult {
  roomId: string;
  idToken?: string;
}
```

&#x20;If you use OAuth for customers authorization that provides ID Token, it will be available in callback.

```
closer.init({
  orgId: "00000000-0000-0000-0000-000000000000",
  onUserAuthorizationSuccess: (authorizationResult: {idToken?: string}) => console.log(idToken)
});
```

Sometimes your user might not authorize, especially when using OAuth. There is other callback for that situation.

```
closer.init({
  orgId: "00000000-0000-0000-0000-000000000000",
  onUserAuthorizationFailed: () => console.log("User authorization failed")
});
```
