我用auth0用angularjs创建函数login。
当我输入电子邮件和密码登录成功不返回信息,并再次重定向到登录页面。我检查数据返回看不到' id_token '。
app.js包括配置认证
var rootApp = angular.module('xxxx', [ 'auth0.lock', ]); rootApp.config(function(lockProvider) { lockProvider.init({ clientID: 'xxxxx', domain: 'xxxx', auth:{ redirectUrl: window.location.origin + '/callback', responseType: 'token', params: { scope: 'openid profile' } }, options: { _idTokenVerification: true, configurationBaseUrl: 'https://cdn.auth0.com', theme:{ logo:'/logos/full_size/medium.png', primaryColor:'#C59D18' } } }); });
身份验证服务.js
(function () {
'use strict';
angular.module('BlurAdmin')
.service('authService', authService);
authService.$inject = ['lock', '$location'];
function authService(lock, $location) {
function login() {
// Display the Lock widget using the
// instance initialized in the app.js config
lock.show();
}
function logout() {
// Remove tokens and expiry time from localStorage
localStorage.removeItem('access_token');
localStorage.removeItem('id_token');
localStorage.removeItem('expires_at');
$location.path('/');
}
function handleAuthentication() {
// Uncomment if you are not using HTML5Mode
// lock.interceptHash();
lock.on('authenticated', function(authResult) {
if (authResult && authResult.accessToken && authResult.idToken) {
console.log('Authenticated!', authResult);
_setSession(authResult);
}
});
lock.on('authorization_error', function(err) {
console.log(err);
alert(
'Error: ' + err.error + '. Check the console for further details.'
);
});
}
function _setSession(authResult) {
// Set the time that the Access Token will expire
var expiresAt = JSON.stringify(
authResult.expiresIn * 1000 + new Date().getTime()
);
// Save tokens and expiration to localStorage
localStorage.setItem('access_token', authResult.accessToken);
localStorage.setItem('id_token', authResult.idToken);
localStorage.setItem('expires_at', expiresAt);
}
function isAuthenticated() {
// Check whether the current time is
// past the Access Token's expiry time
var expiresAt = JSON.parse(localStorage.getItem('expires_at'));
return new Date().getTime() < expiresAt;
}
return {
login: login,
logout: logout,
handleAuthentication: handleAuthentication,
isAuthenticated: isAuthenticated
};
}
})();
乍一看,您可能没有收到id_token
,因为您没有在应用程序中指定。js
响应类型包含id_token
:
auth: {
...
responseType: 'token id_token',
...
}
试一试,你应该很高兴!
我正在我的 SPA 应用程序中实现 Auth0,其中一个要求是拥有一个自定义 UI,这也意味着我无法使用重定向到 Auth0 的通用登录页面。 在阅读了Auth0网站后,我发现了资源所有者授权类型,这似乎解决了我直接使用Auth0 API处理登录的问题。 使用这种授予类型有什么缺点吗??(我读到这不是很推荐,但我想听听关于这一点的意见) 此外,这种资助类型还有其他选择吗??我是说,如果Biz不想要
我有一个带有MySQL的Spring Boot应用程序。我可以在数据库中保存用户,但当我试图登录时,它总是说用户名或密码不正确。即使当我硬编码一个用户,它仍然不工作。 我使用JavaBrains教程和他们在GitHub上的代码创建了这个设置。 安全配置: 我的UserDetailsService 我的用户详细信息 登录页面上的登录表单 我没有登录的POST映射,因为它应该由Spring Secur
我正在将 Auth0 Lock 与 连接一起使用,我需要获取,因为我需要在用户离线时从服务器端进行 API 调用。 我遵循他们的指南,但它不起作用,总是。 使用 还尝试了或 此处的说明:https://github.com/auth0/rules/blob/master/rules/google-refresh-token.md
问题内容: 当我输入网址时,它将出错 例如: 错误结果是这样的: 当我用或替换为时,会没事的。怎么发生的? 问题答案: 请阅读flask快速入门中的 唯一URL /重定向行为,
我已经在VPS DebianLinux上安装了最新版本的RabbitMQ。试图通过访客/访客登录,但返回消息登录失败。我做了一点研究,发现出于安全原因,禁止通过访客/访客远程登录。 我还尝试通过创建rabbitmq来远程登录此版本上的来宾使用。手动配置文件(因为安装没有创建文件),并仅放置以下条目 使用以下命令重新启动rabbitmq之后。 它仍然没有让我用访客/访客登录。我也尝试过在视窗VPS上
在这里,我已经设置了默认的安全域 以下是我在web.xml中的配置: 以下是AIS.Properties中的配置: UserBean登录功能: 它给了我以下例外: