简体   繁体   English

使用ember-cli和ember-simple-auth的POST /令牌400(错误请求)

[英]POST /token 400 (Bad Request) with ember-cli and ember-simple-auth

I just setup the example from https://github.com/simplabs/ember-cli-simple-auth-example using Cloud9 and I get a 400 Bad Request error when I try to login. 我只是使用Cloud9从https://github.com/simplabs/ember-cli-simple-auth-example设置示例,尝试登录时出现400错误请求错误。

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 : 我很确定这是由于Cloud9仅打开端口80而造成的(如本说明中从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. 由于OAuth 2.0身份验证器默认情况下将使用相同的域和端口将身份验证请求发送到加载了Ember.js的身份,因此您需要将其配置为使用http://localhost:3000

Unfortunately I don't know how I might work around this. 不幸的是,我不知道该如何解决。 Any ideas? 有任何想法吗?

Add the host to the whitelist in the config: 将主机添加到配置中的白名单中:

window.ENV['simple-auth'] = {
  crossOriginWhitelist: ['http://some.other.domain:1234']
}

More info in the Cross Origin Authorization section of the docs 文档的“ 交叉来源授权”部分中的更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM