# Authentication Via API Key

**URL:** <https://opendataforum.transport.nsw.gov.au/t/authentication-via-api-key/136>\
**Category:** Uncategorized\
**Created:** [May 25, 2016, 5:04am UTC](https://opendataforum.transport.nsw.gov.au/t/authentication-via-api-key/136 "2016-05-25T05:04:13Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Webmaster](https://sea1.discourse-cdn.com/flex019/user_avatar/opendataforum.transport.nsw.gov.au/webmaster/32/228_2.png) [@Webmaster](https://opendataforum.transport.nsw.gov.au/u/Webmaster)\
**Post date:** [May 25, 2016, 5:04am UTC](https://opendataforum.transport.nsw.gov.au/t/authentication-via-api-key/136/1 "2016-05-25T05:04:13Z")

</div>

Hello,

Looks like things are progressing, thank you.

I am still seeing authentication via API key failing.

This means per user per session authentication is required, which is the first of it’s kind I’ve seen (this can also cause unnecessary work for application support).

I am hoping getting all authentication methods in the API Explorer working is on your todo list.

😐

---

<div class="post-metadata">

**Author:** ![yvonne.lee](https://avatars.discourse-cdn.com/v4/letter/y/c37758/32.png) [@yvonne.lee](https://opendataforum.transport.nsw.gov.au/u/yvonne.lee)\
**Post date:** [May 25, 2016, 10:46pm UTC](https://opendataforum.transport.nsw.gov.au/t/authentication-via-api-key/136/2 "2016-05-25T22:46:38Z")

</div>

“it’s on the list” 🙂

We’re trying to get more simple authentication that doesn’t timeout in place.

---

<div class="post-metadata">

**Author:** ![Webmaster](https://sea1.discourse-cdn.com/flex019/user_avatar/opendataforum.transport.nsw.gov.au/webmaster/32/228_2.png) [@Webmaster](https://opendataforum.transport.nsw.gov.au/u/Webmaster)\
**Post date:** [October 22, 2016, 7:12pm UTC](https://opendataforum.transport.nsw.gov.au/t/authentication-via-api-key/136/3 "2016-10-22T19:12:24Z")

</div>

Hello,

Any update on the status of getting authentication by API key working? 😕

---

<div class="post-metadata">

**Author:** ![Webmaster](https://sea1.discourse-cdn.com/flex019/user_avatar/opendataforum.transport.nsw.gov.au/webmaster/32/228_2.png) [@Webmaster](https://opendataforum.transport.nsw.gov.au/u/Webmaster)\
**Post date:** [October 22, 2016, 7:20pm UTC](https://opendataforum.transport.nsw.gov.au/t/authentication-via-api-key/136/4 "2016-10-22T19:20:39Z")

</div>

Hello,

Any update on the status of getting authentication by API key working? 😕

---

<div class="post-metadata">

**Author:** ![phiali](https://sea1.discourse-cdn.com/flex019/user_avatar/opendataforum.transport.nsw.gov.au/phiali/32/221_2.png) [@phiali](https://opendataforum.transport.nsw.gov.au/u/phiali)\
**Post date:** [October 22, 2016, 11:08pm UTC](https://opendataforum.transport.nsw.gov.au/t/authentication-via-api-key/136/5 "2016-10-22T23:08:13Z")

</div>

API Key authentication is available and shouldn’t time out at all. Have a look at [https://opendata.transport.nsw.gov.au/site/en\_us/gs-intro.html](https://opendata.transport.nsw.gov.au/site/en_us/gs-intro.html) which details OAuth and API authentication methods.

After creating an application with API Key add a Authorization header set to “apikey my\_key\_goes\_here”.

---

<div class="post-metadata">

**Author:** ![alejandro.felman](https://avatars.discourse-cdn.com/v4/letter/a/bbe5ce/32.png) [@alejandro.felman](https://opendataforum.transport.nsw.gov.au/u/alejandro.felman)\
**Post date:** [October 23, 2016, 10:33pm UTC](https://opendataforum.transport.nsw.gov.au/t/authentication-via-api-key/136/6 "2016-10-23T22:33:52Z")

</div>

Hi @Webmaster, as @phiali said, this should work correctly. Please follow the steps in our user guide page linked above and try again. If you’re still having problems feel free to message me the command you’re using so I can review it.

Thanks,  
Alex

---

<div class="post-metadata">

**Author:** ![Webmaster](https://sea1.discourse-cdn.com/flex019/user_avatar/opendataforum.transport.nsw.gov.au/webmaster/32/228_2.png) [@Webmaster](https://opendataforum.transport.nsw.gov.au/u/Webmaster)\
**Post date:** [October 26, 2016, 10:53pm UTC](https://opendataforum.transport.nsw.gov.au/t/authentication-via-api-key/136/7 "2016-10-26T22:53:42Z")

</div>

Thanks for the help.

By authentication via API Key I mean as described in the API Explorer.

Authentication by just the api\_key as in:

[https://api.transport.nsw.gov.au/v1/gtfs/realtime/nswtrains?apikey=mykey](https://api.transport.nsw.gov.au/v1/gtfs/realtime/nswtrains?apikey=mykey)

I have OAuth working, but that requires a per user per session unique token, which is a framework we currently do not have implemented.

So, I am asking if there is any progress on completing support for authentication via API key as listed in the API Explorer? 😕

---

<div class="post-metadata">

**Author:** ![phiali](https://sea1.discourse-cdn.com/flex019/user_avatar/opendataforum.transport.nsw.gov.au/phiali/32/221_2.png) [@phiali](https://opendataforum.transport.nsw.gov.au/u/phiali)\
**Post date:** [October 26, 2016, 11:36pm UTC](https://opendataforum.transport.nsw.gov.au/t/authentication-via-api-key/136/8 "2016-10-26T23:36:12Z")

</div>

The API key can’t be specified in the URL so you’ll need to set it in the HTTP headers.

---

<div class="post-metadata">

**Author:** ![Webmaster](https://sea1.discourse-cdn.com/flex019/user_avatar/opendataforum.transport.nsw.gov.au/webmaster/32/228_2.png) [@Webmaster](https://opendataforum.transport.nsw.gov.au/u/Webmaster)\
**Post date:** [October 27, 2016, 1:35am UTC](https://opendataforum.transport.nsw.gov.au/t/authentication-via-api-key/136/9 "2016-10-27T01:35:36Z")

</div>

I selected Header as the API Key Type in API Explorer and still get 401 Unauthorized

I manually added a header parameter apikey with mykey as value and type header and still got 401 Unauthorized.

😕

---

<div class="post-metadata">

**Author:** ![Webmaster](https://sea1.discourse-cdn.com/flex019/user_avatar/opendataforum.transport.nsw.gov.au/webmaster/32/228_2.png) [@Webmaster](https://opendataforum.transport.nsw.gov.au/u/Webmaster)\
**Post date:** [October 27, 2016, 1:47am UTC](https://opendataforum.transport.nsw.gov.au/t/authentication-via-api-key/136/10 "2016-10-27T01:47:43Z")

</div>

Okay, I’m seeing the User Guide is updated.

I followed the instructions and instead of 401, I get redirected to the Dashboard. (Perhaps caused by a protobuf response).

I’ll take all this to mean you have it up and running now.

Thank you for the help.

🕶
