Skip to content

Commit

Permalink
docs: fix typos (#448)
Browse files Browse the repository at this point in the history
  • Loading branch information
grjan7 authored Jul 20, 2024
1 parent 6d95d67 commit 2806d75
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
30 changes: 15 additions & 15 deletions API.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# API

Node.js client library for [OAuth2](http://oauth.net/2/). OAuth2 allows users to grant access to restricted resources by third party applications, giving them the possibility to enable and disable those accesses whenever they want.
Node.js client library for [OAuth2](http://oauth.net/2/). OAuth2 allows users to grant access to restricted resources by third-party applications, giving them the possibility to enable and disable those accesses whenever they want.

## Options

Expand All @@ -14,18 +14,18 @@ Simple OAuth2 grant classes accept an object with the following params.

* `auth` - required object with the following properties:
* `tokenHost` - Base URL used to obtain access tokens. Required
* `tokenPath` - URL path to obtain access tokens (See [url resolution notes](#url-resolution)). Defaults to **/oauth/token**
* `refreshPath` - URL path to refresh access tokens (See [url resolution notes](#url-resolution)). Defaults to `auth.tokenPath`
* `revokePath` - URL path to revoke access tokens (See [url resolution notes](#url-resolution)). Defaults to **/oauth/revoke**
* `tokenPath` - URL path to obtain access tokens (See [URL resolution notes](#url-resolution)). Defaults to **/oauth/token**
* `refreshPath` - URL path to refresh access tokens (See [URL resolution notes](#url-resolution)). Defaults to `auth.tokenPath`
* `revokePath` - URL path to revoke access tokens (See [URL resolution notes](#url-resolution)). Defaults to **/oauth/revoke**
* `authorizeHost` - Base URL used to request an *authorization code*. Only valid for *AuthorizationCode*. Defaults to `auth.tokenHost` value
* `authorizePath` - URL path to request an *authorization code* (See [url resolution notes](#url-resolution)). Only valid for *AuthorizationCode*. Defaults to **/oauth/authorize**
* `authorizePath` - URL path to request an *authorization code* (See [URL resolution notes](#url-resolution)). Only valid for *AuthorizationCode*. Defaults to **/oauth/authorize**

* `http` optional object used to set default options to the internal http library ([wreck](https://github.com/hapijs/wreck)). All options except **baseUrl** are allowed
* `json`: JSON response parsing mode. Defaults to **strict**
* `redirects` Number or redirects to follow. Defaults to **false** (no redirects)
* `headers` Http headers
* `accept` Acceptable http response content type. Defaults to **application/json**
* `authorization` Always overriden by the library to properly send the required credentials on each scenario
* `accept` Acceptable http response content-type. Defaults to **application/json**
* `authorization` Always overridden by the library to properly send the required credentials on each scenario

* `options` additional options to setup how the module perform requests
* `scopeSeparator` Scope separator character. Some providers may require a different separator. Defaults to **empty space**
Expand All @@ -45,7 +45,7 @@ Creates the authorization URL from the *client configuration* and the *authorize

* `redirectURI` String representing the registered application URI where the user is redirected after authentication
* `scope` String or array of strings representing the application privileges
* `state` String representing an opaque value used by the client to main the state between the request and the callback
* `state` String representing an opaque value used by the client to maintain the state between the request and the callback

Additional options will be automatically serialized as query params in the resulting URL.

Expand All @@ -59,7 +59,7 @@ Get a new access token using the current grant type.

Additional options will be automatically serialized as params for the token request.

* `httpOptions` All [wreck](https://github.com/hapijs/wreck) options can be overriden as documented by the module `http` options.
* `httpOptions` All [wreck](https://github.com/hapijs/wreck) options can be overridden as documented by the module `http` options.

#### .createToken(token) => AccessToken
Creates a new access token by providing a token object as specified by [RFC6750](https://tools.ietf.org/html/rfc6750#section-4).
Expand All @@ -77,7 +77,7 @@ Get a new access token using the current grant type.

Additional options will be automatically serialized as params for the token request.

* `httpOptions` All [wreck](https://github.com/hapijs/wreck) options can be overriden as documented by the module `http` options.
* `httpOptions` All [wreck](https://github.com/hapijs/wreck) options can be overridden as documented by the module `http` options.

#### .createToken(token) => AccessToken
Creates a new access token by providing a token object as specified by [RFC6750](https://tools.ietf.org/html/rfc6750#section-4).
Expand All @@ -93,7 +93,7 @@ Get a new access token using the current grant type.

Additional options will be automatically serialized as params for the token request.

* `httpOptions` All [wreck](https://github.com/hapijs/wreck) options can be overriden as documented by the module `http` options.
* `httpOptions` All [wreck](https://github.com/hapijs/wreck) options can be overridden as documented by the module `http` options.

#### .createToken(token) => AccessToken
Creates a new access token by providing a token object as specified by [RFC6750](https://tools.ietf.org/html/rfc6750#section-4).
Expand All @@ -109,21 +109,21 @@ Refreshes the current access token. The following params are allowed:

* `params`
* `[scope]` Optional string or array including a subset of the original token scopes to request
* `httpOptions` All [wreck](https://github.com/hapijs/wreck) options can be overriden as documented by the module `http` options.
* `httpOptions` All [wreck](https://github.com/hapijs/wreck) options can be overridden as documented by the module `http` options.

Additional options will be automatically serialized as query params for the token request.

#### await .revoke(tokenType, [httpOptions])
Revokes either the access or refresh token depending on the {tokenType} value. Token type can be one of: `access_token` or `refresh_token`.

* `httpOptions` All [wreck](https://github.com/hapijs/wreck) options can be overriden as documented by the module `http` options.
* `httpOptions` All [wreck](https://github.com/hapijs/wreck) options can be overridden as documented by the module `http` options.

#### await .revokeAll([httpOptions])
Revokes both the current access and refresh tokens

* `httpOptions` All [wreck](https://github.com/hapijs/wreck) options can be overriden as documented by the module `http` options.
* `httpOptions` All [wreck](https://github.com/hapijs/wreck) options can be overridden as documented by the module `http` options.

#### .token
Immutable object containing the token object provided while constructing a new access token instance. This property will usually have the schema as specified by [RFC6750](https://tools.ietf.org/html/rfc6750#section-4), but the exact properties may vary between authorization servers.

Please also note, that the current implementation will always add an **expires_at** property regardless of the authorization server response, as we require it to to provide the refresh token functionality.
Please also note that the current implementation will always add an **expires_at** property regardless of the authorization server response, as we require it to provide the refresh token functionality.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing

Fork the repo on github and send a pull requests with feature branches to the ```develop``` branch. Do not forget to provide tests to your contribution.
Fork the repo on GitHub and send a pull requests with feature branches to the ```develop``` branch. Do not forget to provide tests to your contribution.

## Node version
This project is pinned to an specific node version for local development by using [volta](https://volta.sh/) as engines manager. Make sure you have it installed, to ensure your changes are tested with our recommended engine.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ See the [API reference](./API.md#new-clientcredentialsoptions) for a complete re

### Access Token

On completion of any [supported grant type](#supported-grant-types) an access token will be obtained. A list of supported operations can be found below.
On completion of any [supported grant type](#supported-grant-types), an access token will be obtained. A list of supported operations can be found below.

#### Refresh an access token

On long lived applications, it is often necessary to refresh access tokens. In such scenarios the access token is usually persisted in an external database by first serializing it.
On long-lived applications, it is often necessary to refresh access tokens. In such scenarios, the access token is usually persisted in an external database by first serializing it.


```javascript
Expand Down Expand Up @@ -321,7 +321,7 @@ Simple OAuth 2.0 is licensed under the [Apache License, Version 2.0](http://www.

## Thanks to Open Source

Simple OAuth 2.0 come to life thanks to the work I've made in Lelylan, an open source microservices architecture for the Internet of Things. If this project helped you in any way, think about giving us a <a href="https://github.com/lelylan/lelylan">star on Github</a>.
Simple OAuth 2.0 come to life thanks to the work I've made in Lelylan, an open source microservices architecture for the Internet of Things. If this project helped you in any way, think about giving us a <a href="https://github.com/lelylan/lelylan">star on GitHub</a>.

<a href="https://github.com/lelylan/lelylan">
<img src="https://raw.githubusercontent.com/lelylan/lelylan/master/public/logo-lelylan.png" data-canonical-src="https://raw.githubusercontent.com/lelylan/lelylan/master/public/logo-lelylan.png" width="300"/></a>

0 comments on commit 2806d75

Please sign in to comment.