https://github.com/loginradius/apple-revoke-access-token
https://github.com/loginradius/apple-revoke-access-token
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/loginradius/apple-revoke-access-token
- Owner: LoginRadius
- License: mit
- Created: 2022-07-07T07:53:42.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-04-07T01:23:22.000Z (about 3 years ago)
- Last Synced: 2024-12-27T01:42:46.742Z (over 1 year ago)
- Language: JavaScript
- Size: 148 KB
- Stars: 0
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Apple revoke access token
This repository provides details on how to invalidate the apple access token based on LoginRadius AccountDeletion webhook event response https://www.loginradius.com/docs/integrations/webhook/.
## Description
This respository provides a (POST) API endpoint which accepts the LoginRadius AccountDeletion webhook event response.
For the Sample AccountDeletion webhook event response please see: https://www.loginradius.com/docs/integrations/webhooks/samples/#deleteaccount9
To get AccountDeletion webhook event response on your URL, please configured it from the LoginRadius Admin Console: https://www.loginradius.com/docs/api/v2/integrations/webhooks/overview/#configurewebhook7
## Installation
Run this command to install the required dependency.
``` bash
npm install
```
Create a `.env` file in root directory and add following constants
1. Create an environment variable `client_id` and add the apple client_id, which will be used in apple revoke token API call.
2. Create an environment variable `client_secret` and add the apple client_secret, which will be used in apple revoke token API call.
For insights on how to create apple client_secret, please see https://github.com/LoginRadius/apple-client-secret-generator
e.g

Run this command to start the server
```bash
npm start
```
### Apple access token deletion endpoint API.
This Api revokes the apple access token received from the user profile
#### Api Endpoint:
`http://localhost:3000/api/webhook`
### Sample Request Payload

Sample respone:
#### Output
```json
{
"description": "",
"statusCode": 200
}
Note: On success, Apple only returns HTTP code as 200 and does not return any success message/description
```
### Common Error:
```json
{
"message": "{\"error\":\"invalid_client\"}",
"description": "",
"statusCode": 400,
"stackTrace": "Error: got 400 response\n at generateErrorMessage ....."
}
Note: It signifies Apple provided `client_id` and `client_secret` are incorrect/expired.
```
Note: this script consider your apple social provide name as `apple`, if for your LoginRadius App, apple social provider is configured with different name e.g apple_brand1 then please replace the same in the /api/webHookController.js file. ScreenShot reference:
