# First time login for a user using API KEY

**URL:** <https://meta.discourse.org/t/first-time-login-for-a-user-using-api-key/249660>\
**Category:** SSO\
**Tags:** openid-connect, rest-api\
**Created:** [December 22, 2022, 11:34am UTC](https://meta.discourse.org/t/first-time-login-for-a-user-using-api-key/249660 "2022-12-22T11:34:09Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![mohit\_kumar](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mohit_kumar/32/284559_2.png) [@mohit\_kumar](https://meta.discourse.org/u/mohit_kumar)\
**Post date:** [December 22, 2022, 11:34am UTC](https://meta.discourse.org/t/first-time-login-for-a-user-using-api-key/249660/1 "2022-12-22T11:34:09Z")

</div>

Hi All,

I am using Discourse as a backend only there is no discourse UI involvement. To use API, I am using username and global api key to hit the request.  
I am facing 1 problem that is whenever a new user is created in my OIDC provider(Keycloak), I just cannot use it’s username in my API. Discourse is not recognising the user.  
I tried to debug this and realized that discourse also creates a user when a user successfully login from OIDC for the first time and it shows banner on UI that account successfully created. After this only I can use the username to hit the API.  
I want to automate this flow without need of UI. Basically I mean, If a user is created in my OIDC platform then without using UI, I should be able to use it’s username and global api key to hit my request. I am open for hitting additional API.

Any leads will be helpful.  
Thanks in Advance!!

---

_[View the full topic](https://meta.discourse.org/t/first-time-login-for-a-user-using-api-key/249660)._
