簡體   English   中英

簡單的ember-cli-simple-auth和oauth2項目

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

我是第三方認證的新手,還無法通過ember-cli-simple-auth插件與simple-auth-oauth2配對向LinkedIn發出API請求。 我的environment.js在下面,其中我嘗試將Simple Labs的Introduction1和http://ember-simple-auth.com/ember-simple-auth-api-docs.html1的各個部分拼湊在一起,特別是在底部環境==='測試'的位置。 構建CLI項目后,我沒有收到任何錯誤,但是在瀏覽器的控制台中確實收到一條通知(不是警告或錯誤),內容為:

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

現在,我只是想從LinkedIn找回身份驗證令牌,不確定下一步是什么。 如果我嘗試在我的登錄控制器上觸發“ authenticate”操作(擴展了loginControllerMixin),則控制台中將顯示錯誤消息:

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

我錯過了哪些部分?


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