# URL for Oauth  token

**URL:** <https://forum.sierrawireless.com/t/url-for-oauth-token/8824>\
**Category:** AirVantage Enterprise Platform\
**Created:** [September 28, 2016, 11:28am UTC](https://forum.sierrawireless.com/t/url-for-oauth-token/8824 "2016-09-28T11:28:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamieeasterman](https://avatars.discourse-cdn.com/v4/letter/j/cab0a1/32.png) [@jamieeasterman](https://forum.sierrawireless.com/u/jamieeasterman)\
**Post date:** [September 28, 2016, 11:28am UTC](https://forum.sierrawireless.com/t/url-for-oauth-token/8824/1 "2016-09-28T11:28:55Z")

</div>

Please confirm this URL should respond with a authentication json object

[na.airvantage.net/api/oauth/tok … &username=](https://na.airvantage.net/api/oauth/token?grant_type=password&username=)[my username]&password=[my password]&client\_id=[from client api]&client\_secret=[from client api]

This is an HTTP GET and no base64 authentication header is required

The username and password I can successfully log in on a browser

The client\_id and client\_secret are from a client API I created on [airvantage.net/develop/api/clients](https://airvantage.net/develop/api/clients)

When I use this URL from my web application I get:

{“error”:“unauthorized”,“error\_description”:“Full authentication is required to access this resource”}

If I use it from a Firefox form POST add-on, whilst having logged in on a session to [airvantage.net/](https://airvantage.net/) i get:

{“error”:“invalid\_client”,“error\_description”:“Given client ID does not match authenticated client”}

---

<div class="post-metadata">

**Author:** ![rjacolin](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/rjacolin/32/4748_2.png) [@rjacolin](https://forum.sierrawireless.com/u/rjacolin)\
**Post date:** [September 28, 2016, 2:28pm UTC](https://forum.sierrawireless.com/t/url-for-oauth-token/8824/2 "2016-09-28T14:28:03Z")

</div>

Hello,

did you escape specific char like @ in %40 in the username?

See [w3schools.com/tags/ref\_urlencode.asp](http://www.w3schools.com/tags/ref_urlencode.asp)

Regards,  
Robert

---

<div class="post-metadata">

**Author:** ![lwchris](https://avatars.discourse-cdn.com/v4/letter/l/f08c70/32.png) [@lwchris](https://forum.sierrawireless.com/u/lwchris)\
**Post date:** [September 29, 2016, 11:52am UTC](https://forum.sierrawireless.com/t/url-for-oauth-token/8824/3 "2016-09-29T11:52:11Z")

</div>

\*NB user change - jamie gave me his login whilst I was getting forum acccess.

It’s fair question.

The Coldfusion application platform will handle urlencoding through its CFHTTP tag automatically.

I was assuming the dedicated HttpRequester add-on is smart enough to do the same, I’m sure it is.

Even so… no harm in hard-encoding it. Still the same results in both cases.

I’ve been told my username should have permission to get the token. Is there a way to confirm this?

---

<div class="post-metadata">

**Author:** ![rjacolin](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/rjacolin/32/4748_2.png) [@rjacolin](https://forum.sierrawireless.com/u/rjacolin)\
**Post date:** [September 29, 2016, 1:11pm UTC](https://forum.sierrawireless.com/t/url-for-oauth-token/8824/4 "2016-09-29T13:11:58Z")

</div>

Hi Chris,

If I use the url you copy in the first post and fill by my credentials and you client\_id/client\_secret, I succeed to get the token.  
I could reproduce your error message by adding a / at the end of the url, right after token. I guess the url is not correct when calling in cloudfront.

Copying and pasting this “bar url” (with oauth/token/) in FF, I get the same error. If I remove the /, all works fine.

I made a test with [cfdocs.org/cfhttp](http://cfdocs.org/cfhttp)

```auto
<cfscript>
cfhttp(method="GET", charset="utf-8", url="https://na.airvantage.net/api/oauth/token?grant_type=password&username=username@swir.com&password=myPassword!&client_id=yourClientId&client_secret=yourClientSecret", result="result") {
   // cfhttpparam(name="q", type="formfield", value="cfml");
}
writeDump(result);
</cfscript>
```

and I get the response.

---

<div class="post-metadata">

**Author:** ![lwchris](https://avatars.discourse-cdn.com/v4/letter/l/f08c70/32.png) [@lwchris](https://forum.sierrawireless.com/u/lwchris)\
**Post date:** [October 4, 2016, 9:53am UTC](https://forum.sierrawireless.com/t/url-for-oauth-token/8824/5 "2016-10-04T09:53:43Z")

</div>

HI Robert

That was it of course. I’m so often blind to trailing slashes, thanks.

If you’ve managed to integrate a full CFML interface to the API I have another Q coming up soon on posting request content-type application/json

Thanks

Chris
