---
title: Identity
---

The MVVM implementation of identity is built on top of what you find the [core](/arc/frontend/core/identity/).
To access identity in an MVVM solution with a view model, the `IdentityProvider` is hooked up to the [container](/arc/frontend/reactmvvm/tsyringe/)
through its interface `IIdentityProvider`.

> Note: This depends on the [MVVM Context](/arc/frontend/reactmvvm/mvvm-context/) being used.

```typescript
import { injectable } from 'tsyringe';
import { IIdentityProvider } from '@cratis/arc/identity';

type IdentityDetails = {
    department: string,
    age: number
};

@injectable()
export class MyViewModel {
    constructor(private readonly _identityProvider: IIdentityProvider) {
    }

    async sayHello() {
        const identity = await this._identityProvider.getCurrent<IdentityDetails>();
        console.log(`Hello '${identity.name}' from ´${identity.details.department}`);
    }
}
```

The code takes a dependency to the abstract class called `IIdentityProvider` representing the interface for the identity provider.
With this the code simply calls the `getCurrent()` method to get the identity.
