Gabriel Ferraz
Gabriel Ferraz

Reputation: 632

angular-auth0 issue: Unknown provider: authProvider <- auth

I am replacing Lock 9 for Lock 10 on my app to be able to add custom options to the signup widget (additional email and password confirmation). To make the transition smooth I am using this library https://github.com/auth0/angular-auth0, as suggested by Ryan Chenkie on this auth0 forum: https://auth0.com/forum/t/is-lock-10-incompatible-with-angular/3297/9 (last post).

According to the library docs, after implementing the scripts and registering the module auth0.auth0 I should have access to auth0Provider in my config block and be able to use it to config the init method. This is the implementation on the docs (you may visit the link as well):

bower install angular-auth0

<script src="bower_components/auth0.js/build/auth0.js"></script>
<script src="bower_components/angular-auth0/build/angular-auth0.js"></script>

var app = angular.module('myApp', ['auth0.auth0']);

app.config(function(auth0Provider) {
  auth0Provider.init({
   clientID: AUTH0_CLIENT_ID,
   domain: AUTH0_DOMAIN
  });
});

This should allow me to use auth in my controllers or runblock in such fashion:

app.run(function(auth) {
  var vm = this;
  vm.auth = auth;
});

However, when I load the app I get this error message: Unknown provider: authProvider <- auth.

Additionally, the file bower_components/angular-auth0/build/angular-auth0.js doesn't have an auth0Provider but an angularAuth0Provider, which I can inject in the config block but doesn't give me access to auth, generating the same Unknown provider: authProvider <- auth error.

I am not sure if I am doing something wrong or if the implementation I am trying is not possible.

Thanks.

Upvotes: 1

Views: 1364

Answers (1)

Stone
Stone

Reputation: 2668

The latest angular package angularAuth0 is a departure from the original in that it's just a thin wrapper around the auth0.js library instead of a more robust client. auth no longer exists and is instead replaced by angularAuth0 which has different functionality altogether. Also, take a look at angular-jwt as much of the isAuthenticated type functionality has moved over to it: https://github.com/auth0/angular-jwt

This upgrade is a complete departure from previous integrations :(

Upvotes: 1

Related Questions