You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Kind**: instance method of [<code>OAuth2Server</code>](#OAuth2Server)
57
-
**Returns**: <code>Promise.<object></code> - A `Promise` that resolves to the access token object returned from [Model#getAccessToken](Model#getAccessToken).
58
-
In case of an error, the promise rejects with one of the error types derived from [OAuthError](OAuthError).
57
+
**Returns**: <code>Promise.<object></code> - A `Promise` that resolves to the access token object returned from the model's `getAccessToken`.
58
+
In case of an error, the promise rejects with one of the error types derived from `OAuthError`.
59
59
**Throws**:
60
60
61
61
- <code>UnauthorizedRequestError</code> The protected resource request failed authentication.
@@ -92,7 +92,7 @@ function authenticateHandler(options) {
92
92
Authorizes a token request.
93
93
**Remarks:**
94
94
95
-
If `request.query.allowed` equals the string `'false'` the access request is denied and the returned promise is rejected with an [AccessDeniedError](AccessDeniedError).
95
+
If `request.query.allowed` equals the string `'false'` the access request is denied and the returned promise is rejected with an `AccessDeniedError`.
96
96
97
97
In order to retrieve the user associated with the request, `options.authenticateHandler` should be supplied.
98
98
The `authenticateHandler` has to be an object implementing a `handle(request, response)` function that returns a user object.
@@ -115,8 +115,8 @@ let authenticateHandler = {
115
115
```
116
116
117
117
**Kind**: instance method of [<code>OAuth2Server</code>](#OAuth2Server)
118
-
**Returns**: <code>Promise.<object></code> - A `Promise` that resolves to the authorization code object returned from [Model#saveAuthorizationCode](Model#saveAuthorizationCode)
119
-
In case of an error, the promise rejects with one of the error types derived from [OAuthError](OAuthError).
118
+
**Returns**: <code>Promise.<object></code> - A `Promise` that resolves to the authorization code object returned from model's `saveAuthorizationCode`
119
+
In case of an error, the promise rejects with one of the error types derived from `OAuthError`.
120
120
**Throws**:
121
121
122
122
- <code>AccessDeniedError</code> The resource owner denied the access request (i.e. `request.query.allow` was `'false'`).
@@ -177,8 +177,8 @@ let options = {
177
177
For information on how to implement a handler for a custom grant type see the extension grants.
178
178
179
179
**Kind**: instance method of [<code>OAuth2Server</code>](#OAuth2Server)
180
-
**Returns**: <code>Promise.<object></code> - A `Promise` that resolves to the token object returned from [Model#saveToken](Model#saveToken).
181
-
In case of an error, the promise rejects with one of the error types derived from [OAuthError](OAuthError).
180
+
**Returns**: <code>Promise.<object></code> - A `Promise` that resolves to the token object returned from the model's `saveToken` method.
181
+
In case of an error, the promise rejects with one of the error types derived from `OAuthError`.
182
182
**Throws**:
183
183
184
184
- <code>InvalidGrantError</code> The access token request was invalid or not authorized.
Copy file name to clipboardExpand all lines: lib/server.js
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -78,8 +78,8 @@ class OAuth2Server {
78
78
* @param [options.addAuthorizedScopesHeader=true] {boolean=} Set the `X-OAuth-Scopes` HTTP header on response objects.
79
79
* @param [options.allowBearerTokensInQueryString=false] {boolean=} Allow clients to pass bearer tokens in the query string of a request.
80
80
* @throws {UnauthorizedRequestError} The protected resource request failed authentication.
81
-
* @return {Promise.<object>} A `Promise` that resolves to the access token object returned from {@link Model#getAccessToken}.
82
-
* In case of an error, the promise rejects with one of the error types derived from {@linkOAuthError}.
81
+
* @return {Promise.<object>} A `Promise` that resolves to the access token object returned from the model's `getAccessToken`.
82
+
* In case of an error, the promise rejects with one of the error types derived from `OAuthError`.
83
83
* @example
84
84
* const oauth = new OAuth2Server({model: ...});
85
85
* function authenticateHandler(options) {
@@ -111,7 +111,7 @@ class OAuth2Server {
111
111
* Authorizes a token request.
112
112
* **Remarks:**
113
113
*
114
-
* If `request.query.allowed` equals the string `'false'` the access request is denied and the returned promise is rejected with an {@linkAccessDeniedError}.
114
+
* If `request.query.allowed` equals the string `'false'` the access request is denied and the returned promise is rejected with an `AccessDeniedError`.
115
115
*
116
116
* In order to retrieve the user associated with the request, `options.authenticateHandler` should be supplied.
117
117
* The `authenticateHandler` has to be an object implementing a `handle(request, response)` function that returns a user object.
@@ -143,8 +143,8 @@ class OAuth2Server {
143
143
* @param [options.allowEmptyState=false] {boolean=} Allow clients to specify an empty `state
144
144
* @param [options.authorizationCodeLifetime=300] {number=} Lifetime of generated authorization codes in seconds (default = 300 s = 5 min)
145
145
* @throws {AccessDeniedError} The resource owner denied the access request (i.e. `request.query.allow` was `'false'`).
146
-
* @return {Promise.<object>} A `Promise` that resolves to the authorization code object returned from {@link Model#saveAuthorizationCode}
147
-
* In case of an error, the promise rejects with one of the error types derived from {@linkOAuthError}.
146
+
* @return {Promise.<object>} A `Promise` that resolves to the authorization code object returned from model's `saveAuthorizationCode`
147
+
* In case of an error, the promise rejects with one of the error types derived from `OAuthError`.
148
148
* @example
149
149
* const oauth = new OAuth2Server({model: ...});
150
150
* function authorizeHandler(options) {
@@ -203,8 +203,8 @@ class OAuth2Server {
203
203
* @param [options.requireClientAuthentication=object] {object|boolean} Require a client secret for grant types (names as keys). Defaults to `true` for all grant types.
204
204
* @param [options.alwaysIssueNewRefreshToken=true] {boolean=} Always revoke the used refresh token and issue a new one for the `refresh_token` grant.
205
205
* @param [options.extendedGrantTypes=object] {object} Additional supported grant types.
206
-
* @return {Promise.<object>} A `Promise` that resolves to the token object returned from {@link Model#saveToken}.
207
-
* In case of an error, the promise rejects with one of the error types derived from {@linkOAuthError}.
206
+
* @return {Promise.<object>} A `Promise` that resolves to the token object returned from the model's `saveToken` method.
207
+
* In case of an error, the promise rejects with one of the error types derived from `OAuthError`.
208
208
* @throws {InvalidGrantError} The access token request was invalid or not authorized.
0 commit comments