简体   繁体   中英

Angular2 OIDC with systemjs

I'm trying to load a library into an Angular2 application using systemjs to bootstrap it.

I have found these two libraries

  1. https://www.npmjs.com/package/ng2-oauth2
  2. https://www.npmjs.com/package/angular-oauth2-oidc

But I'm having trouble to make it all work.

systemjs.config.js along with the other dependencies.

map : { 'ng2-oauth2' : 'node_modules/ng2-oauth2/bundles/ng2-oauth2.js' }

And I'm trying to import it like this, but it fails

import {OAUTH2_PROVIDERS } from 'ng2-oauth2';

So my questions,

  1. Do you have any preference between these libraries ?
  2. Am I doing the mapping wrong or these libraries weren't made for systemjs ?

I want to intergrate my application with Google OIDC as a test IdP and then my own.

you can use angular-oauth2-oidc, here is systemjs config

'angular-oauth2-oidc': {
   main: 'angular-oauth2-oidc.umd.js',
   format: 'cjs',
   defaultExtension: 'js',
   map: {
       'jsrsasign': '/node_modules/jsrsasign/lib/jsrsasign',
   },
   meta: {
        'angular-oauth2-oidc': {
        deps: ['require','jsrsasign']
       },
  }
}

check this for more details

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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