{"action":"opened","issue":{"url":"https://api.github.com/repos/jpadilla/ember-cli-simple-auth-token/issues/87","labels_url":"https://api.github.com/repos/jpadilla/ember-cli-simple-auth-token/issues/87/labels{/name}","comments_url":"https://api.github.com/repos/jpadilla/ember-cli-simple-auth-token/issues/87/comments","events_url":"https://api.github.com/repos/jpadilla/ember-cli-simple-auth-token/issues/87/events","html_url":"https://github.com/jpadilla/ember-cli-simple-auth-token/issues/87","id":100098859,"number":87,"title":"Empty post to login API server","user":{"login":"trapias","id":2881610,"avatar_url":"https://avatars.githubusercontent.com/u/2881610?v=3","gravatar_id":"","url":"https://api.github.com/users/trapias","html_url":"https://github.com/trapias","followers_url":"https://api.github.com/users/trapias/followers","following_url":"https://api.github.com/users/trapias/following{/other_user}","gists_url":"https://api.github.com/users/trapias/gists{/gist_id}","starred_url":"https://api.github.com/users/trapias/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trapias/subscriptions","organizations_url":"https://api.github.com/users/trapias/orgs","repos_url":"https://api.github.com/users/trapias/repos","events_url":"https://api.github.com/users/trapias/events{/privacy}","received_events_url":"https://api.github.com/users/trapias/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-10T15:47:21Z","updated_at":"2015-08-10T15:47:21Z","closed_at":null,"body":"Hello,\r\nI'm very new to Ember.js, trying to setup my environment with an API server I'm developing in Go with JWT authentication. Server authentication is correctly working, I can login to get a JWT token and then access API methods for example via CURL requests, but I'm missing something in having Ember talk with it.\r\n\r\nStarting from the basic setup I see in README I could have my login controller to place a request to the login API, but it appears not to pass any data with the POST (username and password are empty).\r\nI added CORS headers to the server, which answers with necessary headers and an empty body when it gets an OPTIONS request (should be ok, right?):\r\n\r\n\tcurl \"https://localhost:8000/login\" -X OPTIONS --verbose --cacert cert.pem \r\n\t* Hostname was NOT found in DNS cache\r\n\t*   Trying ::1...\r\n\t* Connected to localhost (::1) port 8000 (#0)\r\n\t* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA\r\n\t* Server certificate: Acme Co\r\n\t> OPTIONS /login HTTP/1.1\r\n\t> User-Agent: curl/7.37.1\r\n\t> Host: localhost:8000\r\n\t> Accept: */*\r\n\t> \r\n\t< HTTP/1.1 200 OK\r\n\t< Access-Control-Allow-Headers: Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization\r\n\t< Access-Control-Allow-Origin: *\r\n\t< Access-Control-Request-Method: GET, POST, OPTIONS, PUT, DELETE\r\n\t< Content-Type: application/json\r\n\t< Date: Mon, 10 Aug 2015 15:31:18 GMT\r\n\t< Content-Length: 0\r\n\t< \r\n\t* Connection #0 to host localhost left intact\r\n\r\nI solved all errors I had in browser's console before handing CORS, both at the API server and in ember configuration.\r\nRelevant configuration options now look like this:\r\n\r\n  ENV['simple-auth'] = {\r\n      authorizer: 'simple-auth-authorizer:token'\r\n    };\r\n    ENV['simple-auth-token'] = {\r\n      refreshAccessTokens: true,\r\n      timeFactor: 1,\r\n      refreshLeeway: 300, // Refresh the token 5 minutes (300s) before it expires.\r\n      serverTokenEndpoint: 'https://localhost:8000/login',\r\n      crossOriginWhitelist:[\r\n         'http://localhost:4200',\r\n         'https://localhost:8000'\r\n        ],\r\n      identificationField: 'user',\r\n      passwordField: 'password',\r\n      tokenPropertyName: 'token',\r\n      authorizationPrefix: 'Bearer ',\r\n      authorizationHeaderName: 'Authorization',\r\n      headers: {},\r\n    };\r\n\r\n    ENV.contentSecurityPolicy = {\r\n      'default-src': \"'none'\",\r\n      'script-src': \"'self'\",\r\n      'font-src': \"'self' http://fonts.gstatic.com safari-extension://com.ideashower.pocket.safari-ET279A6R5N\",\r\n      'connect-src': \"'self' https://localhost:8000\",\r\n      'img-src': \"'self'\",\r\n      'style-src': \"'self' 'unsafe-inline' http://fonts.googleapis.com\", \r\n      'media-src': \"'self'\"\r\n    }\r\n\r\nRoutes are apparently ok: I have an application route with ApplicationRouteMixin, and a protected AuthenticatedRouteMixin route that correctly redirects to the login form when requested.\r\nMy ember login controller is just like the example:\r\n\r\n\timport Ember from 'ember';\r\n\r\n\texport default Ember.Controller.extend({\r\n\t  actions: {\r\n\t    authenticate: function() {\r\n\t      var credentials = this.getProperties('user', 'password'),\r\n\t        authenticator = 'simple-auth-authenticator:jwt';\r\n\r\n\t        console.log('Cred: ' + JSON.stringify(credentials)); \r\n\r\n\t      this.get('session').authenticate(authenticator, credentials);\r\n\t    }\r\n\t  }\r\n\t});\r\n\r\nWhen I fill-in the form and click to login I can see credentials are there in console, but they don't reach the server. In browser I see the request that (correctly) gets a 403 from the API server, but the API server login method does not receive any variable in POST: I see an OPTIONS request and then the POST, but POST has no data.\r\n\r\nApp is very basic, just a template created via ember-cli to which I added simple-auth and simple-auth-token. \r\nCan anybody tell what do I miss? Is it something wrong (what?) with my API server, or do I miss something at the ember side? \r\n\r\nThanks for any help,\r\nal.\r\n"}}