Comments (16)
I pushed a fix for that some hours ago.
Of course the strategies branch isn't released yet so no guarantees for it being ready for production...
Am 15.01.2014 um 12:13 schrieb Michaël Gallego [email protected]:
Hi,
I'm trying to use the new strategies branch, however I'm encountering an error:
TypeError: 'null' is not an object (evaluating 'this.get('authenticator').create')
It seems I've followed the example. As JS is not my primary language I'm not sure to be able to spot where the problem comes from.
Thanks!
—
Reply to this email directly or view it on GitHub.
from ember-simple-auth.
I'm already using the latest build :). Still have the error :)
from ember-simple-auth.
Any chance you can give me access to the code or set up a jsbin or so?
Am 15.01.2014 um 12:42 schrieb Michaël Gallego [email protected]:
I'm already using the latest build :). Still have the error :)
—
Reply to this email directly or view it on GitHub.
from ember-simple-auth.
It's in a private repository, but for now it's a completely empty app.
The initializer:
Ember.Application.initializer({
name: 'authentication',
initialize: function(container, application) {
Ember.SimpleAuth.setup(application);
}
});
Login controller:
module.exports = App.LoginController = Ember.Controller.extend(Ember.SimpleAuth.AuthenticationControllerMixin);
Login route:
module.exports = App.LoginRoute = Ember.Route.extend();
Application route:
module.exports = App.ApplicationRoute = Ember.Route.extend(Ember.SimpleAuth.ApplicationRouteMixin);
And the login template:
<form {{action authenticate on='submit'}}>
<div class="control-group">
<label for="identification">Login</label>
{{view Ember.TextField id='identification' valueBinding='identification'}}
</div>
<div class="control-group">
<label for="password">Password</label>
{{view Ember.TextField id='password' type='password' valueBinding='password'}}
</div>
<button type="submit">Login</button>
</form>
from ember-simple-auth.
That’s what was updated earlier today in the examples: you have to mix in
the LoginControllerMixin if you want to use a strategy that takes user
credentials:
module.exports = App.LoginController =
Ember.Controller.extend(Ember.SimpleAuth.LoginControllerMixin);
2014/1/15 Michaël Gallego [email protected]
It's in a private repository, but for now it's a completely empty app.
The initializer:
Ember.Application.initializer({
name: 'authentication',
initialize: function(container, application) {
Ember.SimpleAuth.setup(application);
}});Login controller:
module.exports = App.LoginController = Ember.Controller.extend(Ember.SimpleAuth.AuthenticationControllerMixin);
Login route:
module.exports = App.LoginRoute = Ember.Route.extend();
Application route:
module.exports = App.ApplicationRoute = Ember.Route.extend(Ember.SimpleAuth.ApplicationRouteMixin);
And the login template:
Login {{view Ember.TextField id='identification' valueBinding='identification'}}Password {{view Ember.TextField id='password' type='password' valueBinding='password'}}Login—
Reply to this email directly or view it on GitHubhttps://github.com//issues/62#issuecomment-32359291
.
Marco Otte-Witte
[email protected]
http://simplabs.com
from ember-simple-auth.
Awesome, it works :D. Thanks!
from ember-simple-auth.
Hi,
I've updated to the latest release (the official release) and now I have the following error:
Uncaught TypeError: Cannot call method 'authenticate' of undefined. It happens in the "authenticate" method of the AuthenticationControllerMixin.
Is this an expected issue?
from ember-simple-auth.
No, certainly not expected. Looks like your session is not set. Did you update anything else together with Ember.SimpleAuth?
from ember-simple-auth.
No, I didn't update anything else. :(.
from ember-simple-auth.
can you change your login controller to this:
module.exports = App.LoginController = Ember.Controller.extend(Ember.SimpleAuth.LoginControllerMixin, {
actions: {
authenticate: function() {
console.log(this.get('session'));
this._super();
}
}
});
Also a stack trace for the error would be helpful. Best would of course be a jsbin showing the error.
from ember-simple-auth.
I got "undefined". Here is the code (like previous time):
The initializer:
module.export = (function() {
Ember.Application.initializer({
name: 'authentication',
initialize: function(container, application) {
Ember.SimpleAuth.setup(application, {
routeAfterInvalidation: 'login',
routeAfterAuthentication: 'projects'
});
}
});
Ember.SimpleAuth.Authenticators.OAuth2.reopen({
serverTokenEndpoint: 'http://connect.saas-metrics.localhost/oauth/token'
});
});
The application route:
module.exports = App.ApplicationRoute = Ember.Route.extend(Ember.SimpleAuth.ApplicationRouteMixin);
The login controller:
module.exports = App.LoginController = Ember.Controller.extend(Ember.SimpleAuth.LoginControllerMixin, {
/**
* Error message if login fails
*
* @type {string}
*/
errorMessage: null,
actions: {
/**
* Set an error message when authentication fails
*/
sessionAuthenticationFailed: function(error) {
this.set('errorMessage', JSON.parse(error).error_description);
}
}
});
And finally the login template:
<h2>Login Template</h2>
<form {{action authenticate on='submit'}}>
<div class="control-group">
<label for="identification">Login</label>
{{view Ember.TextField id='identification' valueBinding='identification'}}
</div>
<div class="control-group">
<label for="password">Password</label>
{{view Ember.TextField id='password' type='password' valueBinding='password'}}
</div>
<button type="submit">Login</button>
</form>
{{#if errorMessage}}
<p>{{ errorMessage }}</p>
{{/if}}
Sorry if I miss something again :(.
from ember-simple-auth.
Btw, it would be a nice addition if Ember-Simple-Auth would extract automatically the error message, as it's standardized to be under the "error_description" key. What do you think ? :)
from ember-simple-auth.
Btw, it would be a nice addition if Ember-Simple-Auth would extract automatically the error message, as it's standardized to be under the "error_description" key. What do you think ? :)
Sounds like a good idea to add that to Authenticators.OAuth2
.
Regarding your problem - is Ember.SimpleAuth.setup
running before your controller is created? Maybe the module transpilation somehow changes the order of things there so that the initializer runs later or so?
from ember-simple-auth.
No, it seems initializers are run before controllers. I'll dig a bit more tomorrow...
from ember-simple-auth.
I found it. Actually, the syntax I tried to use:
module.export = (function() {
Ember.Application.initializer({
name: 'authentication',
initialize: function(container, application) {
alert('ok');
Ember.SimpleAuth.setup(application, {
routeAfterInvalidation: 'login',
routeAfterAuthentication: 'projects'
});
}
});
Ember.SimpleAuth.Authenticators.OAuth2.reopen({
serverTokenEndpoint: 'http://connect.saas-metrics.localhost/oauth/token'
});
});
for module exporting was wrong and the initializer was not called. Here is the correct one:
module.export = Ember.Application.initializer({
name: 'authentication',
initialize: function(container, application) {
alert('ok');
Ember.SimpleAuth.setup(application, {
routeAfterInvalidation: 'login',
routeAfterAuthentication: 'projects'
});
}
});
Ember.SimpleAuth.Authenticators.OAuth2.reopen({
serverTokenEndpoint: 'http://connect.saas-metrics.localhost/oauth/token'
});
I need to learn more about modules. I thought I needed to do that so that Ember.SimpleAuth.Authenticators get wrapped too
from ember-simple-auth.
cool
from ember-simple-auth.
Related Issues (20)
- Deprecation: `old-deprecate-method-paths` HOT 1
- Ember Simple Auth: The automatic session initialization is deprecated on Ember 3.28.4 HOT 9
- Is Torii addon abandonned ? HOT 9
- Ember 4.1.0: Use of `assign` has been deprecated. Please use `Object.assign` or the spread operator instead. HOT 1
- Unhandled Promise error detected when using the manual session.setup function HOT 9
- When I logout of one tab the authenticated data still seems to be populated in another tab HOT 1
- React to authentication in a component via modifier HOT 2
- v2 addon format HOT 5
- Typescript error on accessing prohibitAuthentication HOT 3
- CookieStore is not initializing/syncing correctly HOT 2
- Dependency Dashboard
- CookieExpirationTime not being set HOT 2
- When syncing tabs (session store), schedule of the refresh token should be updated
- ember-polyfills.deprecate-assign deprication in Ember 4.4 HOT 2
- Action Required: Fix Renovate Configuration
- ESA's Application route hides host app's route when using pod layout & embroider HOT 5
- Access token does not persist HOT 1
- Neither of test apps work - did you stop maintaining it? HOT 1
- Missing deprecation guide for session events HOT 1
- test-app should use modern Octane syntax
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-simple-auth.