我试图建立托里与我自己的OAuth流和安博-简单-8月。我可以获得一个成功的身份验证事件,但是在我进行身份验证之后,会立即触发invalidateSession触发器,导致会话结束。我可以通过在sessionInvalidated()中拦截/app/routes/application.js (它有ApplicationRouteMixin)来看到这一点。
你们中有谁遇到过这个吗?有什么特别的东西会导致立即的会话验证吗?如有任何建议,将不胜感激。
编辑:我认为这与torii弹出代码有关,因为第一次返回有效,而第二次返回无效。有什么想法吗?
import OAuth2 from 'torii/providers/oauth2-code';
import {configurable} from 'torii/configuration';
export default OAuth2.extend({
name: 'api',
init() { this.set('clientID', this.get('apiKey')); },
baseUrl: configurable('baseUrl'),
redirectUri: configurable('redirectUri'),
responseParams: ['access_token', 'user_id', 'first_name'],
requiredUrlParams: ['client_id', 'redirect_uri', 'response_type'],
open() {
let name = this.get('name');
let url = this.buildUrl();
let redirectUri = this.get('redirectUri');
let responseParams = this.get('responseParams');
// this return works
return { 'yes' : 'no' }
// this return causes the immediate invalidation
return this.get('popup').open(url, responseParams).then((authData) => {
var missingResponseParams = [];
responseParams.forEach(function(param){
if (authData[param] === undefined) {
missingResponseParams.push(param);
}
});
if (missingResponseParams.length){
throw new Error("The response from the provider is missing " +
"these required response params: " + missingResponseParams.join(', '));
}
return {
access_token: authData.access_token,
first_name: authData.first_name,
user_id: authData.user_id,
provider: name,
redirectUri: redirectUri
};
});
}
});发布于 2016-03-17 00:46:34
真正的答案是使用这个叉子:https://github.com/simplabs/ember-simple-auth/pull/931 (希望它很快就会出现)。
发布于 2016-03-04 01:56:03
你可能在某个地方有this.get('session').invalidate();。可能在您的控制器操作属性中。您通常会将其放在操作中,以供注销按钮使用。也许你是偶然复制和粘贴的。如果你发布一些代码,我可以再看一遍
https://stackoverflow.com/questions/35784260
复制相似问题