ember-simple-auth | implementing authentication/authorization in Ember.js | Authentication library
kandi X-RAY | ember-simple-auth Summary
kandi X-RAY | ember-simple-auth Summary
Ember Simple Auth is a lightweight library for implementing authentication/ authorization with Ember.js applications. It has minimal requirements with respect to application structure, routes etc. With its pluggable strategies it can support all kinds of authentication and authorization mechanisms.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ember-simple-auth
ember-simple-auth Key Features
ember-simple-auth Examples and Code Snippets
// app/controllers/login.js
import Ember from 'ember';
export default Ember.Controller.extend({
// ...
actions: {
// ...
authenticate() {
this.send('dismissError');
let headers = {};
if (this.get('twoFactorRequired'))
Community Discussions
Trending Discussions on ember-simple-auth
QUESTION
Looking for a way to set header in Ember ADAPTER LATER with the value returned from an async call.
Trying to set the idToken returend from Amplify's Auth.currentSession()
, which is a promise function which internally handles refreshing the token on expiration.
Something like this to await the response -
...ANSWER
Answered 2020-Jun-18 at 19:35A possible solution is to override the adapter's ajax
method.
QUESTION
This question is related to: Does Ember Octane Route class support using mixins? Mixins are officially deprecated in Ember Octane.
Question:
What is the best option to replace Ember mixins with and how do I implement it?
Context:
I have custom mixins that expand functionality offered by ember-simple-auth (~v1.8.2), which was not available at the time the methods were created (see below). I am currently using ember-simple-auth 3.0.0 https://github.com/simplabs/ember-simple-auth. In the documentation on github, they appear to be using their own mixins on Ember Octane as you can see:
...ANSWER
Answered 2020-Apr-20 at 10:36Firstly I want to make very clear that mixins are not "officially deprecated" in Ember, and to my knowledge there's not even an active RFC about it. As the Upgrade Guides explain, Glimmer components do not support mixins due to not extending EmberObject, but the pre-existing framework classes (Route, Controller, etc) necessarily have to or it would be a breaking change.
There is no best option to replace mixins as it depends on the usage of the API. If you are asking how to replace ember-simple-auth mixins, my answer is that you can't until the addon itself provides alternative APIs. Mixins and the example code you posted will continue working for the foreseeable future.
You can see an example of using class inheritance to share functionality in this PR.
QUESTION
I’m able to get an xlsx file from my rails backend with a GET-Request to “/companies/export_xslx”, now I’m facing the problem of getting the file passed the JSON parser. For every request the console shows “JSON.parse: unexpected character at line 1 column 1 of the JSON data”.
This is my setup:
...ANSWER
Answered 2020-Mar-19 at 17:00I've found a solution. I tackle the problem in the component with a download service:
QUESTION
I have not much experienced in Ember dependency
I have searched but i can not find which ember addon version compatibility with ember-cli or node version
I can find only this ember-cli node support https://github.com/ember-cli/ember-cli/blob/master/docs/node-support.md
Do I have to experience all , I can only guess version compatibility
For example : ember-simple-auth@2.1.0 compatible with ember-cli 3.x , ember-simple-auth@1.1.0 compatible with ember-cli 2.x
https://www.npmjs.com/package/ember-simple-auth/v/2.1.0
In the topic "Basic Usage" , i saw the Ember code syntax then this is it
For example : nodejs v6.x , npm v3.x, ember-cli 2.13 , Let's say it is working i want to add "ember-cli-sass" , which version i must choose ?
Is there a way to find out or isn't there something like that
Thanks
...ANSWER
Answered 2019-Nov-16 at 19:53Most addons include a compatibility statement in their readme. Such a compatibility statement is generated by default blueprint for Ember addons. If such a statement exist, you could view the readme for the latest as well as for old versions on GitHub.
If the addon does not document the compatibility explicitly, you could have a look in CI configuration. Most ember addon use Travis as a continuous integration pipeline. The configuration is stored in .travis.yml
file as part of the source code in repository. It should list the used node versions and the ember-source
versions the tests are run again. Most ember addons run their tests against some ember versions out of their support range - most likely the LTS versions covered by their compatibility statement.
The supported node version is for most ember addons determined by the used version of Ember CLI. There is a good chance that the addon will work with a specific node version if that version is supported by Ember CLI version used by the addon. Have a look in package.json
for ember-cli
package to get the used version.
QUESTION
I have a current-client
service in Ember that is designed to pull the current user's information from the database and store it inside the service so that it can be used throughout the application. As long as I click on the navigation menu links, the current user information is preserved. But, when changing the URL in the address bar, the current user gets wiped out and the service has to go back and get the information again.
Why is this happening and how can I prevent it from happening?
Update: I am using the authenticationMixins from Ember-Simple-Auth. Ideally, the solution provided will not impact this. For example, when the client is authenticated and logged in, if they try to navigate to the Login page then they should just be routed to the Index page, instead. Alternatively, if the unauthenticated client attempts to navigate to a protected page by just typing in the URL, then the application should authenticate the user and then route them to the page that they were originally trying to navigate to (without forcing the user to re-navigate).
Update 2: Specifically, the information that is being wiped out is whether the client has successfully completed their 2FA (i.e., isTwoFactorAuthenticated
goes from True to False). This impacts the navigation menu that we are drawing based on whether the client is both authenticated and 2FA completed. In other words, the navigation menu is wrong because it makes the client look like they are logged out even though they are not.
Service: Current-client.js
...ANSWER
Answered 2019-Sep-09 at 05:29Since you are using ember-simple-auth
already you can use the session service to store/cache the data. This will tie it to authentication so when the user logs out the data is also removed. By default ember-simple-auth
stores session data in local storage which persists even when the browser is closed you may need to customize this to fit your requirements.
QUESTION
Here is my code:
...ANSWER
Answered 2019-Aug-13 at 08:26I have fixed this issue. See the examples in the documentation.
QUESTION
I am working on a new Ember.js project and using ember-cli-mirage to stub out my requests. The project is going to use ember-simple-auth
and Auth0 for user authentication. I began implementing them in my project, but I'm getting a weird error in the console when I try to sign up with my Google account using the Auth0 login modal:
ANSWER
Answered 2019-May-27 at 17:30Ember CLI Mirage intercepts all ajax (XMLHttpRequest
) and fetch
requests by default. You have to whitelist the requests that should be passed through by using server.passthrough()
method. (this
is server
instance in mirage/config.js
.) You could use relative and absolute URLs with server.passthrough
as well as with all route handlers. So server.passthrough('https://(my auth0 domain).auth0.com/userinfo')
should fix your issue.
QUESTION
In my api, I have a /users endpoint which currently shows (eg address) details of all users currently registered. This needs to be accessed by the (Ember) application (eg to view a user shipping address) but for obvious reasons I can't allow anyone to be able to view the data (whether that be via the browsable api or as plain JSON if we restrict a view to just use the JSONRenderer). I don't think I can use authentication and permissions, since the application needs to log a user in from the front end app (I am using token based authentication) in the first instance. If I use authentication on the user view in Django for instance, I am unable to login from Ember.
Am I missing something?
UPDATE
Hi, I wanted to come back on this.
For authentication on the Ember side I'm using Ember Simple Auth and token based authentication in Django. All is working fine - I can log into the Ember app, and have access to the token.
What I need to be able to do is to access the user; for this I followed the code sample here https://github.com/simplabs/ember-simple-auth/blob/master/guides/managing-current-user.md
I have tested the token based authentication in Postman, using the token for my logged in user - and can access the /users endpoint. (This is returning all users - what I want is for only the user for whom I have the token to be returned but that's for later!).
The question is how to do I pass the (token) header in any Ember requests, eg
...ANSWER
Answered 2019-May-15 at 10:28Ember is framework for creating SPAs. These run in the browser. So for Ember to get the data, you have to send the data to the browser.
The browser is completely under the control of the user. The browser is software that works for them, not for the owner of the website.
Any data you send to the browser, the user can access. Full stop.
If you want to limit which bits of the data the user can read from the API, then you need to write the logic to apply those limits server-side and not depend on the client-side Ember code to filter out the bits you don't want the user to see.
I don't think I can use authentication and permissions, since the application needs to log a user in from the front end app (I am using token based authentication) in the first instance. If I use authentication on the user view in Django for instance, I am unable to login from Ember.
This doesn't really make sense.
Generally, this should happen:
- The user enters some credentials into the Ember app
- The ember app sends them to an authentication endpoint on the server
- The server returns a token
- The ember app stores the token
- The ember app sends the token when it makes the request for data from the API
- The server uses the token to determine which data to send back from the API
QUESTION
I have an ember app where I log on and it authenticates me using ember-cognito and ember-simple-auth.
...ANSWER
Answered 2019-May-07 at 12:07Just include isomorphic-fetch as polyfill to make it work on unsupported browsers.
QUESTION
I am using ember with ember-simple-auth(1.7.0) for authentication. Here is the application adapter function :
...ANSWER
Answered 2019-Mar-15 at 10:51You need to create fetch wrapper service and use it, instead of "raw" fetch and boilerplating.
Raw usage possible with headers - https://github.com/github/fetch#post-json
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ember-simple-auth
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page