Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jpalumickas/node-oauth2-server-grant-type-apple
Apple login grant type for node oauth2-server
https://github.com/jpalumickas/node-oauth2-server-grant-type-apple
apple hacktoberfest node nodejs oauth oauth2 oauth2-server
Last synced: 16 days ago
JSON representation
Apple login grant type for node oauth2-server
- Host: GitHub
- URL: https://github.com/jpalumickas/node-oauth2-server-grant-type-apple
- Owner: jpalumickas
- License: mit
- Created: 2020-09-20T17:40:14.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-29T20:38:17.000Z (over 2 years ago)
- Last Synced: 2024-10-04T06:43:08.943Z (about 1 month ago)
- Topics: apple, hacktoberfest, node, nodejs, oauth, oauth2, oauth2-server
- Language: TypeScript
- Homepage:
- Size: 390 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OAuth2 Server Apple Grant Type
Adds Apple grant type for [oauth2-server][oauth2-server]
## Installation
Using Yarn
```sh
yarn add oauth2-server-grant-type-apple
```Using NPM
```sh
npm install oauth2-server-grant-type-apple
```## Usage
Add `getUserWithApple` to [oauth2-server] model.
```js
const getUserWithApple = async (jwtData) => {
// Find and return user by Apple ID (sub in jwtData)// Find and return user by Apple email
// If not exists create new user
}
```Add Apple grant type to `extendedGrantTypes` in [oauth2-server] options:
```js
import AppleGrantType from 'oauth2-server-grant-type-apple';const options = {
model: ...,
extendedGrantTypes: {
apple: AppleGrantType,
}
requireClientAuthentication: {
apple: false,
},
}
```You need to provide Apple App ID in model `appleGrantType` :
```js
const options = {
model: {
...model,
appleGrantType: {
appId: 'com.example.apple.login' // Array also supported
},
},
}
```Post request to `/oauth/token` with `apple` grant type and provided token:
```json
{
"grant_type": "apple",
"client_id": "YOUR_CLIENT_ID",
"apple_token": "APPLE_JWT_TOKEN",
"name": "User full name"
}
```## License
The package is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
[oauth2-server]: https://github.com/oauthjs/node-oauth2-server