Please confirm this URL should respond with a authentication json object
na.airvantage.net/api/oauth/tok … &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
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/ i get:
{“error”:“invalid_client”,“error_description”:“Given client ID does not match authenticated client”}
Hello,
did you escape specific char like @ in %40 in the username?
See w3schools.com/tags/ref_urlencode.asp
Regards,
Robert
lwchris
September 29, 2016, 11:52am
3
*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?
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
<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.
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