# API request to users/by-external on private forum

**URL:** <https://meta.discourse.org/t/api-request-to-users-by-external-on-private-forum/60609>\
**Category:** Development\
**Created:** [April 7, 2017, 6:40pm UTC](https://meta.discourse.org/t/api-request-to-users-by-external-on-private-forum/60609 "2017-04-07T18:40:13Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
**Post date:** [April 7, 2017, 7:07pm UTC](https://meta.discourse.org/t/api-request-to-users-by-external-on-private-forum/60609/3 "2017-04-07T19:07:53Z")

</div>

> [@Falco](#):
>
> Are you using a valid admin API key and API username?

Thanks! I wasn’t using an API key or username. When I add them the user is returned.

Edit: I answered that too quickly. When I add the API key and API username to the request it’s no longer being redirected to `/session/sso` but it’s returning `Discourse::InvalidAccess` from `lib/auth/default_current_user_provider.rb, line 79`

After that, the next function call in my application is finding the user by their email address. Unfortunately, I’m making the call from WordPress, so the email address isn’t a reliable way to find the user.

---

_[View the full topic](https://meta.discourse.org/t/api-request-to-users-by-external-on-private-forum/60609)._
