auth0-samples / auth0-angularjs-sample Goto Github PK
View Code? Open in Web Editor NEWThese samples are made up of steps to add Auth0 to an Angular JS app
These samples are made up of steps to add Auth0 to an Angular JS app
Problem is described here. Documentation not updated for latest auth0-lock 10.8.
When implementing this I am getting the following error:
Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to:
Error: [$injector:modulerr] Failed to instantiate module auth0.auth0 due to:
ReferenceError: Auth0 is not defined
Any ideas what might be causing that?
Hey, I am using auth0 for my angularJs application.
Actually I am getting this error
This is my config.js
**require.config({
waitSeconds: 60,
paths: {
angular: '../bower_components/angular/angular',
'angular-ui-router': '../bower_components/angular-ui-router/release/angular-ui-router',
jquery: '../bower_components/jquery/dist/jquery.min',
jqueryui: '../bower_components/jquery-ui/jquery-ui.min',
bootstrap: '../bower_components/bootstrap/dist/js/bootstrap.min',
underscore: '../bower_components/underscore/underscore-min',
'angular-ui-utils': '../bower_components/angular-ui-utils/ui-utils.min',
'moment': '../bower_components/moment/moment',
'cookies': '../bower_components/cookies-js/dist/cookies',
'angular-bootstrap': '../bower_components/angular-bootstrap/ui-bootstrap-tpls',
'toastr': '../bower_components/angular-toastr/dist/angular-toastr.tpls',
'angularTreeview': '../libs/angular.treeview/angular.treeview',
'angular-confirm-modal': '../bower_components/angular-confirm-modal/angular-confirm.min',
'rangy-core': '../bower_components/rangy/rangy-core.min',
'rangy-selectionsave': '../bower_components/rangy/rangy-selectionsaverestore.min',
'textAngular-sanitize': '../libs/textAngular/textAngular-sanitize.min',
'textAngularSetup': '../libs/textAngular/textAngularSetup',
'textAngular': '../libs/textAngular/textAngular',
'anguFixedHeaderTable': '../bower_components/angu-fixed-header-table/angu-fixed-header-table',
'io.dennis.contextmenu': '../bower_components/angular-contextmenu/dist/contextmenu',
'bootstrap-tokenfield': '../bower_components/bootstrap-tokenfield/dist/bootstrap-tokenfield.min',
'auth0': "../bower_components/auth0.js/build/auth0",
'auth0.auth0': "../bower_components/angular-auth0/dist/angular-auth0"
},
shim: {
jquery: {
exports: 'jquery'
},
jqueryui: {
deps: ['jquery']
},
bootstrap: {
deps: ['jquery']
},
angular: {
exports: 'angular',
deps: ['jquery']
},
'angular-ui-router': {
deps: ['angular']
},
'angular-ui-utils': {
deps: ['angular']
},
'angular-bootstrap': {
deps: ['angular']
},
'toastr': {
deps: ['angular']
},
'angularTreeview': {
deps: ['angular']
},
'angular-confirm-modal': {
deps: ['angular', 'angular-bootstrap']
},
'textAngularRangySetup': {
exports: 'rangy'
},
'rangy-selectionsave': {
deps: ['rangy-core']
},
'textAngular-sanitize': {
deps: ['angular']
},
'textAngularSetup': {
deps: ['angular']
},
'textAngular': {
exports: 'textAngular',
deps: ['angular', 'textAngular-sanitize', 'textAngularSetup']
},
'anguFixedHeaderTable': {
deps: ['angular']
},
'io.dennis.contextmenu': {
deps: ['angular']
},
'bootstrap-tokenfield': {
deps: ['jquery']
},
'auth0': {
exports: "auth0"
},
'auth0.auth0': {
"deps": ["angular", "auth0"]
},
}
});
require(['rangy-core', 'rangy-selectionsave'], function (rangyCore) {
window.rangy = rangyCore;
});**
App.js
define([
'angular',
'angular-ui-router',
'auth0',
'auth0.auth0'
], function(angular,
appConfig,
suggestions,
displayMapping,
AppConstants) {
'use strict';
**// define the module and any module dependencies
var appModule = angular.module('app', [
'ui.router',
'ui.bootstrap',
'toastr',
'angularTreeview',
'angular-confirm',
'textAngular',
'anguFixedHeaderTable',
'io.dennis.contextmenu'
]);
//configure module
appModule
.config(appConfig);
return appModule;
});**
My main.js
**[define([
'jquery',
'underscore',
'angular',
'bootstrap',
'jqueryui',
'app/app'
], function($, _, angular) {
'use strict';
try {
if (!window.jasmine) {
angular.bootstrap(document, ['app']);
}
} catch (e) {
// don't bootstrap more than once.
if(this.console && this.console.log){
console.log(e);
}
}
});](url)**
so, Here I am getting this error.
Uncaught ReferenceError: auth0 is not defined
at Object. (angular-auth0.js:152)
at webpack_require (angular-auth0.js:20)
at Object.module.exports (angular-auth0.js:74)
at webpack_require (angular-auth0.js:20)
at Object.defineProperty.value (angular-auth0.js:63)
at angular-auth0.js:66
So, How to resolve this issue ?
Numerous people using auth0 lock have had this issue where the authenticated event does not fire. See https://auth0.com/forum/t/authenticated-event-not-triggering/3554. It is fixed by adding the following to the options property when calling lockProvider.init() ...
`var options = {
//Must have these two settings for auth0 lock to work properly!
auth: {
redirect: false,
responseType: 'token'
}
};
lockProvider.init({
clientID: APP_CONFIG.auth0ClientId,
domain: APP_CONFIG.auth0Domain,
options: options
}); `
Why has the "calling API" example been removed?
Would it be possible to replace it with a link to how you suggest we call API's? Is the next step to use the API guide relevant to whichever API backend framework is preferred?
The reason this is not just straightforward as previously is because:
So now that the example of calling an API has been removed and no documentation has replaced it to solve this more complex problem.
This is relevant to commit a2484f0
I am trying to use this example with Requirejs but doesn't seem to have any luck... It keeps on throwing
Failed to instantiate module auth0.auth0 due to:
ReferenceError: Auth0 is not defined
Is it possible to get an example using RequireJS, I also tried to use example of angular-lock but that also throws similar error about Auth0Lock is not defined.
Following is my require.config, not sure what I am doing wrong here...
require.config({
"paths": {
"jquery": "node_modules/" + "jquery/dist/jquery.min",
"angular": "node_modules/" + "angular/angular.min",
"ngRoute": "node_modules/" + "angular-route/angular-route.min",
"lodash": "node_modules/" + "lodash/lodash",
"bootstrap": "node_modules/" + "bootstrap/dist/js/bootstrap.min",
"ui.bootstrap": "node_modules/" + "angular-ui-bootstrap/dist/ui-bootstrap-tpls",
"auth0": "bower_components/" + "auth0.js/build/auth0",
"auth0.auth0":"bower_components/" + "angular-auth0/dist/angular-auth0",
"angular-jwt":"bower_components/" + "angular-jwt/dist/angular-jwt",
"domReady": "node_modules/" + "requirejs-domReady/domReady",
"SYS.Controllers": "js/controllers/" + "controllers",
"SYS.Service.Auth": "js/services/" + "SYS.Service.Auth"
},
"shim": {
"angular": {
"exports": "angular"
},
"ngRoute": {
"deps": ["angular"]
},
"bootstrap": {
"deps": ["jquery"]
},
"ui.bootstrap": {
"deps": ["angular", "bootstrap"]
},
"lodash": {
"exports": "_"
},
"auth0": {
"exports": "Auth0"
},
"auth0.auth0": {
"deps": ["angular", "auth0"]
},
"angular-jwt": {
"deps": ["angular"]
}
}
});
I would appreciate any help regarding fixing this.
cheers
Ashish
Are these going to be supported?
angular.js:68 Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to:
TypeError: lockProvider.init is not a function
whille trying to incorporate this into my project.
Getting the above exception.
Using angular version : 1.5.8
It seems that the profile attributes (name, email, roles etc) are not being passed in the jwt when making the server call. So the spring backend cannot resolve these and return UNKNOWN_USER.
Is there any other config to be done to make this happen?
It's making call to url - https://hg-mroe.auth0.com/usernamepassword/login (hg-more.auth0.com is auth0 domain) but it's giving 404 (connection not found).
Please help me in running the sample code
// home.controller.js
vm.logoutFromAuth0 = function() {
angularAuth0.logout({returnTo: 'http://localhost:3001/'});
authService.logout();
}
After logging out, its not redirecting to 'http://localhost:3001/'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.