mainmatter/ember-simple-auth-example

POST /token 400 (Bad Request)

Closed this issue · 7 comments

Hey guys, just setup the example using Cloud9 and I get a 400 Bad Request error when I try to login.

I'm pretty sure this is due to fact that Cloud9 only opens port 80 (as referenced in this note from http://log.simplabs.com/post/90339547725/using-ember-simple-auth-with-ember-cli:

"As the OAuth 2.0 authenticator would by default use the same domain and port to send the authentication requests to that the Ember.js is loaded from you need to configure it to use http://localhost:3000 instead."

Unfortunately I don't know how I might work around this. Any ideas?

Thanks!

-James

Ember Simple Auth's cross origin protection would result in the request not being sent at all. If you see a 400 response that means that the server doesn't understand the request (and it actually got sent). I'd guess the server expects some other request body or additional data in the body or headers or something,

Thanks, I think the contents of the POST are dictated by the form as built in the example. I haven't changed that. I tried changing adjusting the serverTokenEndpoint and it generated the cross domain error, after which I added the crossOriginWhitelist, but it came back to the 400 error:

ENV['simple-auth-oauth2'] = {
serverTokenEndpoint: 'https://url/token',
crossOriginWhitelist: ['https://url']
}

Do you get the 400 response for the pre-flight OPTIONS request?

I think so, the stack trace shows vendor.js:9726 (http://prntscr.com/48al64) and when I look at that it shows 'xhr.send( ( options.hasContent && options.data ) || null );'

So yes, I believe it's the options request.

That probably means that the server doesn't support CORS then.

Can this be closed then?

sure, yes

On Mon, Aug 18, 2014 at 1:15 AM, Marco Otte-Witte notifications@github.com
wrote:

Can this be closed then?


Reply to this email directly or view it on GitHub
#1 (comment)
.