So, I have read through all 81 pages of the REST API thread and not found an answer.
I am new to SWIFT and trying to use the REST API. Getting stuck at the auth component.
I have read Tesla Model S JSON API · Apiary
and I know its....
POST https://owner-api.teslamotors.com/oauth/token
Attributes
So I am doing the usual
let url = NSURL(string: "https://owner-api.teslamotors.com/oauth/token")!
let request = NSMutableURLRequest(URL: url)
request.HTTPMethod = "POST"
request.setValue("password", forHTTPHeaderField: "grant_type")
and setting the rest of the header values
But I get back...
"Www-Authenticate" = "Bearer realm=\"Doorkeeper\", error=\"invalid_request\", error_description=\"The request is missing a required parameter, includes an unsupported parameter value, or is otherwise malformed.\"";
Optional("{\"error\":\"invalid_request\",\"error_description\":\"The request is missing a required parameter, includes an unsupported parameter value, or is otherwise malformed.\"}")
I am new to SWIFT and trying to use the REST API. Getting stuck at the auth component.
I have read Tesla Model S JSON API · Apiary
and I know its....
POST https://owner-api.teslamotors.com/oauth/token
Attributes
- grant_type
- client_id
- client_secret
- password
So I am doing the usual
let url = NSURL(string: "https://owner-api.teslamotors.com/oauth/token")!
let request = NSMutableURLRequest(URL: url)
request.HTTPMethod = "POST"
request.setValue("password", forHTTPHeaderField: "grant_type")
and setting the rest of the header values
But I get back...
"Www-Authenticate" = "Bearer realm=\"Doorkeeper\", error=\"invalid_request\", error_description=\"The request is missing a required parameter, includes an unsupported parameter value, or is otherwise malformed.\"";
Optional("{\"error\":\"invalid_request\",\"error_description\":\"The request is missing a required parameter, includes an unsupported parameter value, or is otherwise malformed.\"}")