# Send OTP confirmation code alter login using REST API

**URL:** <https://forum.keycloak.org/t/send-otp-confirmation-code-alter-login-using-rest-api/22164>\
**Category:** Miscellanaeous\
**Created:** [May 17, 2023, 11:39am UTC](https://forum.keycloak.org/t/send-otp-confirmation-code-alter-login-using-rest-api/22164 "2023-05-17T11:39:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rcbandit](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/rcbandit/32/7189_2.png) [@rcbandit](https://forum.keycloak.org/u/rcbandit)\
**Post date:** [May 17, 2023, 11:39am UTC](https://forum.keycloak.org/t/send-otp-confirmation-code-alter-login-using-rest-api/22164/1 "2023-05-17T11:39:14Z")

</div>

With Postman I tried to create a request(like a React SPA app) to generate token:

```auto
POST: http://123.123.123.123:8080/realms/admin_console_realm/protocol/openid-connect/token?client_id=admin_console_client&grant_type=password

```

I get response:

```auto
{
    "access_token": "eyJhb....X8N8ulVbQ",
    "expires_in": 300,
    "refresh_expires_in": 1800,
    "refresh_token": "eyJhbGc....Q",
    "token_type": "Bearer",
    "not-before-policy": 0,
    "session_state": "5595860d-35d8-4fe1-9f6f-147c38255172",
    "scope": "email profile"
}

```

What should be the proper way to send a username and password and then to use confirmation code (OTP code) received by e-mail for Keycloak 21?
