WordPress OAuth2 Server implementation
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
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
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
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.