# Create only one session

**URL:** <https://forum.keycloak.org/t/create-only-one-session/21540>\
**Category:** Miscellanaeous\
**Created:** [April 17, 2023, 12:01pm UTC](https://forum.keycloak.org/t/create-only-one-session/21540 "2023-04-17T12:01:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SmtxSoftDev](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/smtxsoftdev/32/8280_2.png) [@SmtxSoftDev](https://forum.keycloak.org/u/SmtxSoftDev)\
**Post date:** [April 17, 2023, 12:01pm UTC](https://forum.keycloak.org/t/create-only-one-session/21540/1 "2023-04-17T12:01:13Z")

</div>

Hi, i am created user spi provider for my monolithic project, and user spi is working fine, as client i am using postman for generating access token, but when you create multiply request is creating multiply access tokens, and multiply session i did not like it, my question is how can i create only one session?

Source code is here: [GitHub - SmtxSoftDev/keycloak-core-user-spi](https://github.com/SmtxSoftDev/keycloak-core-user-spi)

Or how can i do thomething like this?

```auto
@Override
    public boolean isValid(RealmModel realmModel, UserModel userModel, CredentialInput credentialInput) {
       // This is only example 
       if(keycloakSession.isHasSessions){
                 keycloakSession.removeAllSession();
        }
        // This is only example
        if(userData.isValid){
               createNewSession();
        }
        return true;  
    }

```
