首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >成员简单8月在与Torii验证后立即使会话无效。

成员简单8月在与Torii验证后立即使会话无效。
EN

Stack Overflow用户
提问于 2016-03-03 22:23:30
回答 2查看 272关注 0票数 3

我试图建立托里与我自己的OAuth流和安博-简单-8月。我可以获得一个成功的身份验证事件,但是在我进行身份验证之后,会立即触发invalidateSession触发器,导致会话结束。我可以通过在sessionInvalidated()中拦截/app/routes/application.js (它有ApplicationRouteMixin)来看到这一点。

你们中有谁遇到过这个吗?有什么特别的东西会导致立即的会话验证吗?如有任何建议,将不胜感激。

编辑:我认为这与torii弹出代码有关,因为第一次返回有效,而第二次返回无效。有什么想法吗?

代码语言:javascript
复制
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
      };
    });
  }
});
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-03-17 00:46:34

真正的答案是使用这个叉子:https://github.com/simplabs/ember-simple-auth/pull/931 (希望它很快就会出现)。

票数 3
EN

Stack Overflow用户

发布于 2016-03-04 01:56:03

你可能在某个地方有this.get('session').invalidate();。可能在您的控制器操作属性中。您通常会将其放在操作中,以供注销按钮使用。也许你是偶然复制和粘贴的。如果你发布一些代码,我可以再看一遍

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35784260

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档