Skip to content

Commit db32147

Browse files
authored
Merge pull request #281 from fenichelar/master
Update readme and packages
2 parents 964c39e + 6bc0db5 commit db32147

File tree

3 files changed

+30
-55
lines changed

3 files changed

+30
-55
lines changed

README.md

+11-21
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
This is Ember addon is an extension to the Ember Simple Auth library that provides a basic token authenticator, a JSON Web Tokens token authenticator with automatic refresh capability, and an authorizer mixin. You can find more about why JSON Web Tokens are so awesome in [this article][medium-jwt].
88

9-
**Because user's credentials and tokens are exchanged between the
10-
Ember.js app and the server, you must use HTTPS for this connection!**
9+
**Because user's credentials and tokens are exchanged between the Ember.js app and the server, you must use HTTPS for this connection!**
1110

1211
## Demo
1312

@@ -68,8 +67,7 @@ export default Controller.extend({
6867

6968
#### JSON Web Token Authenticator
7069

71-
The JSON Web Token authenticator will decode the token and look for the
72-
expiration time found. The difference in the current time and the token expiration time is calculated. The `refreshLeeway` is subtracted from this value to determine when the automatic token refresh request should be made.
70+
The JSON Web Token authenticator will decode the token and look for the expiration time found. The difference in the current time and the token expiration time is calculated. The `refreshLeeway` is subtracted from this value to determine when the automatic token refresh request should be made.
7371

7472
```js
7573
// config/environment.js
@@ -99,9 +97,15 @@ To debug JSON Web Token issues, see [jwt][jwt].
9997

10098
The JSON Web Token authenticator supports both separate access tokens and refresh tokens. By specifying the `tokenPropertyName` and the `refreshTokenPropertyName` to the same value, the same token will be used for both access and refresh requests. For more information about refresh tokens, see [this blog][blog-refresh-token].
10199

102-
### Adapter Mixin
100+
### Mixins
103101

104-
In order to send the token with all API requests made to the server, the token adapter mixin should be used:
102+
In order to send the token with all API requests made to the server, the `token-adapter` mixin or `token-authorizer` mixin should be used. When using `ember-simple-auth` >= 3.0.0, use the `token-adapter` mixin. When using `ember-simple-auth` < 3.0.0, use the `token-authorizer` mixin. The mixin will add the header to each API request:
103+
104+
```
105+
Authorization: Bearer <token>
106+
```
107+
108+
#### Adapter Mixin
105109

106110
```js
107111
// app/adapters/application.js
@@ -111,15 +115,7 @@ import TokenAdapterMixin from 'ember-simple-auth-token/mixins/token-adapter';
111115
export default DS.JSONAPIAdapter.extend(TokenAdapterMixin);
112116
```
113117

114-
The mixin will add the header to each API request:
115-
116-
```
117-
Authorization: Bearer <token>
118-
```
119-
120-
### Authorizer Mixin
121-
122-
In order to send the token with all API requests made to the server, the token authorizer mixin should be used:
118+
#### Authorizer Mixin
123119

124120
```js
125121
// app/adapters/application.js
@@ -129,12 +125,6 @@ import TokenAuthorizerMixin from 'ember-simple-auth-token/mixins/token-authorize
129125
export default DS.JSONAPIAdapter.extend(TokenAuthorizerMixin);
130126
```
131127

132-
The mixin will add the header to each API request:
133-
134-
```
135-
Authorization: Bearer <token>
136-
```
137-
138128
### Customization Options
139129

140130
#### Token Authenticator

package-lock.json

+18-33
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ember-simple-auth-token",
3-
"version": "5.1.0",
3+
"version": "5.1.1",
44
"description": "An authenticator and authorizer for Ember Simple Auth that is compatible with token-based authentication like JWT in Ember CLI applications.",
55
"directories": {
66
"doc": "doc",

0 commit comments

Comments
 (0)