https://github.com/codexshaper/wp-oauth2
OAuth2 implementation for WordPress
https://github.com/codexshaper/wp-oauth2
Last synced: 6 months ago
JSON representation
OAuth2 implementation for WordPress
- Host: GitHub
- URL: https://github.com/codexshaper/wp-oauth2
- Owner: Codexshaper
- License: gpl-2.0
- Created: 2020-06-20T11:28:58.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T09:25:37.000Z (about 3 years ago)
- Last Synced: 2025-07-04T06:45:20.267Z (8 months ago)
- Language: CSS
- Size: 4.67 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Description
WordPress OAuth2 Server implementation
# Get access token by `client_credentials` grant
```
endpoint: /cos/oauth/token
method: post
body: {
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"grant_type": "client_credentials"
}
```
It'll return `token_type`, `expires_in`, `access_token`
# Get access token by `password` grant
```
endpoint: /cos/oauth/token
method: post
body: {
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"grant_type": "password",
"username": "YOUR_WP_USER_EMAIL",
"password": "YOUR_WP_USER_PASSWORD"
}
```
It'll return `token_type`, `expires_in`, `access_token`, `refresh_token`
# Refresh and get new access token by `refresh_token` grant
```
endpoint: /cos/oauth/token
method: post
body: {
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"grant_type": "refresh_token",
"refresh_token": "PREVEIOSLY_GENERETED_REFRESH_TOKEN"
}
```
It'll return `token_type`, `expires_in`, `access_token`, `refresh_token`
# Scope - You can restrict your resource by passings `scope`
```
endpoint: /cos/oauth/token
method: post
body: {
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"grant_type": "client_credentials",
"scope": "SCOPE_1 SCOPE_2 SCOPE_3"
}
```
Note: If you choose multiple scope then all scopes must be seperate by space delimeter.