vue.js - 登录时出现 Auth0 和 Nuxt JS 400(无法获取脚本源)错误
问题描述
我对 nuxt 领域很陌生,每次尝试登录时都会遇到 400 页。除了添加 ENV 文件之外,我直接按照Auth/nuxt Docs的指示进行操作。
我还添加了我的应用程序 URI 以允许我的本地主机
这是我的Nuxt.config.js
文件,里面包含所有 auth0 配置。
export default {
// Modules: https://go.nuxtjs.dev/config-modules
modules: [
'@nuxtjs/axios',
'@nuxtjs/pwa',
'@nuxtjs/auth-next',
],
axios: {
baseURL: 'http://localhost:5000',
},
env: {
DOMAIN: process.env.DOMAIN,
CLIENT_ID: process.env.CLIENT_ID,
REDIRECT_URI: process.env.REDIRECT_URI,
},
// Auth0 Authentication
auth: {
redirect: {
login: '/login', // redirect user when not connected
logout: '/',
callback: '/home',
},
strategies: {
auth0: {
domain: process.env.DOMAIN,
client_id: process.env.CLIENT_ID,
audience: 'https://MyApiLinkFromAuth0',
},
},
},
}
这是我在/login
页面中的组件。
<template>
<div>
Login Page
<div>
<button @click="login">Login</button>
</div>
</div>
</template>
<script>
export default {
methods: {
login() {
this.$auth.loginWith('auth0')
},
},
}
</script>
解决方案
原来它是一个错字client_id
。应该是clientId
。auth0 日志有所帮助。
推荐阅读
- sql - Sql Server 复制运行缓慢
- javascript - 使用 http-proxy-middleware 包的自定义响应
- arrays - Hyperlegder 结构节点错误:2 未知:流已删除请求 GET /api/fabric/1_0/channels 的未处理错误:
- jquery - 如何从外部 jquery 平台调用 .net dll 中的方法?
- c# - 这个例子使用delegate()的确切含义是什么?
- clojure - 制作数独求解器
- json - 从 SQL-Server (T-SQL) 调用 Web 服务
- r - 从具有不同参数的终端并行运行相同的 R 脚本
- godot - 全局变量数据未通过 [Godot.2.15]
- angular - 角度 6 单元测试 Forkjoin 服务响应