# Need to get access token using user credentials in WebAPI

**URL:** <https://devforum.okta.com/t/need-to-get-access-token-using-user-credentials-in-webapi/24861>\
**Category:** Questions\
**Created:** [July 19, 2023, 11:06am UTC](https://devforum.okta.com/t/need-to-get-access-token-using-user-credentials-in-webapi/24861 "2023-07-19T11:06:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![WaqasHameed](https://avatars.discourse-cdn.com/v4/letter/w/e79b87/32.png) [@WaqasHameed](https://devforum.okta.com/u/WaqasHameed)\
**Post date:** [July 19, 2023, 11:06am UTC](https://devforum.okta.com/t/need-to-get-access-token-using-user-credentials-in-webapi/24861/1 "2023-07-19T11:06:13Z")

</div>

I need to authenticate user credential from Okta and get access token in Web API.  
Please help me in this implementation.

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [July 20, 2023, 5:41pm UTC](https://devforum.okta.com/t/need-to-get-access-token-using-user-credentials-in-webapi/24861/2 "2023-07-20T17:41:02Z")

</div>

Are you referring to our [.NET WebAPI](https://github.com/okta/okta-aspnet/blob/master/docs/aspnetcore-webapi.md) library? If so, that library is not designed to fetch tokens for a user and is instead used to protect your resource server with Access tokens issued by Okta. You will need to use a different library/set-up to get these tokens, which will involve a client-side component (for example, a SPA that can log the user into Okta and request tokens).

If you’re looking at WebAPI, you may want to check out our sample apps. Our SPA samples (in [React](https://github.com/okta/samples-js-react), [Angular](https://github.com/okta/samples-js-angular), and [Vue](https://github.com/okta/samples-js-vue)) are all designed to integrate with our Resource Server samples (in your case, for either [.NET Core 3.x](https://github.com/okta/samples-aspnetcore/tree/master/samples-aspnetcore-3x/resource-server), [.NET 4.x](https://github.com/okta/samples-aspnet/tree/master/resource-server), or [.NET Core 6.x](https://github.com/okta/samples-aspnetcore/tree/master/samples-aspnetcore-6x/resource-server))

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [September 12, 2023, 1:20pm UTC](https://devforum.okta.com/t/need-to-get-access-token-using-user-credentials-in-webapi/24861/3 "2023-09-12T13:20:36Z")

</div>

Closed on September 12, 2023, 1:20pm UTC

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
