Webpack Auth0示例网页包解析错误
我正在尝试使用Auth0设置我的第一个vue.js 2应用程序。API部分工作正常,但我在与auth0快速启动中描述的auth服务相关的网页包中遇到错误: 我不太理解这个类中使用的语法,因为auth0是import语句中使用的名称。我的应用程序是一个标准的vue.js scaffold生成的带有webpack的应用程序 以下是quickstart中的整个.js:Webpack Auth0示例网页包解析错误,webpack,vuejs2,auth0,Webpack,Vuejs2,Auth0,我正在尝试使用Auth0设置我的第一个vue.js 2应用程序。API部分工作正常,但我在与auth0快速启动中描述的auth服务相关的网页包中遇到错误: 我不太理解这个类中使用的语法,因为auth0是import语句中使用的名称。我的应用程序是一个标准的vue.js scaffold生成的带有webpack的应用程序 以下是quickstart中的整个.js: import auth0 from 'auth0-js' import { AUTH_CONFIG } from './auth0-v
import auth0 from 'auth0-js'
import { AUTH_CONFIG } from './auth0-variables'
import EventEmitter from 'eventemitter3'
import router from './../router'
export default class AuthService {
constructor () {
this.login = this.login.bind(this)
this.setSession = this.setSession.bind(this)
this.logout = this.logout.bind(this)
this.isAuthenticated = this.isAuthenticated.bind(this)
}
auth0 = new auth0.WebAuth({
domain: 'omitted',
clientID: 'omitted',
redirectUri: 'http://localhost:3000/callback',
audience: 'omitted',
responseType: 'token id_token',
scope: 'openid'
})
login () {
this.auth0.authorize()
}
}
我也有同样的问题。结果表明,auth0示例与最新的vue版本不兼容。 这次github回购似乎为我带来了好处:
import auth0 from 'auth0-js'
import { AUTH_CONFIG } from './auth0-variables'
import EventEmitter from 'eventemitter3'
import router from './../router'
export default class AuthService {
constructor () {
this.login = this.login.bind(this)
this.setSession = this.setSession.bind(this)
this.logout = this.logout.bind(this)
this.isAuthenticated = this.isAuthenticated.bind(this)
}
auth0 = new auth0.WebAuth({
domain: 'omitted',
clientID: 'omitted',
redirectUri: 'http://localhost:3000/callback',
audience: 'omitted',
responseType: 'token id_token',
scope: 'openid'
})
login () {
this.auth0.authorize()
}
}