简体   繁体   English

简单的ember-cli-simple-auth和oauth2项目

[英]Simple ember-cli-simple-auth and oauth2 project

I'm very new to 3rd party authentication and have not been able to make an API request to LinkedIn through the ember-cli-simple-auth addon paired with simple-auth-oauth2. 我是第三方认证的新手,还无法通过ember-cli-simple-auth插件与simple-auth-oauth2配对向LinkedIn发出API请求。 My environment.js is below, where I've tried to piece together parts from Simple Labs' introduction1 and http://ember-simple-auth.com/ember-simple-auth-api-docs.html1 , specifically at the bottom of where environment === 'test'. 我的environment.js在下面,其中我尝试将Simple Labs的Introduction1和http://ember-simple-auth.com/ember-simple-auth-api-docs.html1的各个部分拼凑在一起,特别是在底部环境==='测试'的位置。 I don't get any errors after building the CLI project but I do get a notification in the browser's console (not warning or error) that says: 构建CLI项目后,我没有收到任何错误,但是在浏览器的控制台中确实收到一条通知(不是警告或错误),内容为:

No authorizer was configured for Ember Simple Auth - specify one if backend requests need to be authorized.

Right now, I'm just trying to get an auth token back from LinkedIn and am not sure what the next step is. 现在,我只是想从LinkedIn找回身份验证令牌,不确定下一步是什么。 If I try to trigger the "authenticate" action on my login controller (extending the loginControllerMixin), I get an error in the console saying: 如果我尝试在我的登录控制器上触发“ authenticate”操作(扩展了loginControllerMixin),则控制台中将显示错误消息:

Uncaught Error: Assertion Failed: No authenticator for factory "authenticator:simple-auth-oauth2" could be found

What part or parts did I miss? 我错过了哪些部分?


Environment.js: Environment.js:

// config/environment.js
/* jshint node: true */

module.exports = function(environment) {
  var ENV = {
    modulePrefix: 'seminars-me',
    environment: environment,
    baseURL: '/',
    locationType: 'auto',
    EmberENV: {
      FEATURES: {
        // Here you can enable experimental features on an ember canary build
        // e.g. 'with-controller': true
      }
    },

APP: {
  // Here you can pass flags/options to your application instance
  // when it is created
}


 };

  if (environment === 'development') {
    // ENV.APP.LOG_RESOLVER = true;
    // ENV.APP.LOG_ACTIVE_GENERATION = true;
    // ENV.APP.LOG_TRANSITIONS = true;
    // ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
    // ENV.APP.LOG_VIEW_LOOKUPS = true;
  }

  if (environment === 'test') {
    // Testem prefers this...
    ENV.baseURL = '/';
    ENV.locationType = 'none';

// keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;

ENV.APP.rootElement = '#ember-testing';

ENV['simple-auth-oauth2'] = {
  serverTokenEndpoint: 'https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=757ll7ci1xd93u&scope=profile'
};
    ENV['simple-auth'] = {
      authorizer: 'simple-auth-authorizer:oauth2-bearer',
      crossOriginWhitelist: ['https://www.linkedin.com'],
      store: 'simple-auth-session-store:local-storage'
    };
  }

  if (environment === 'production') {

  }

  return ENV;
};

在使用authenticator:simple-auth-oauth2 ,身份验证器实际上已注册为simple-auth-authenticator:oauth2-password-grant

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

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