Overview
Scopes in OAuth 2 are ways to control which data is available to the resource API when a request is made. Out of the box, WP OAuth Server does not support scopes regarding data limitations but does support them in the settings. Basically, you can use scopes but the plugin itself does not restrict data with any of its default API endpoints.
In most cases when scopes are used for WP OAuth Server, it is when custom endpoints are being used. Scopes can be added to an allowed list by visiting a client’s editor window and using the allowed scopes field.
By default, WP OAuth Server supports 4 scopes.
- openid
- profile
- basic
If you would like to add more scopes or modify the scopes that can be used, you have the option to use the wo_scopes
filter.
Add New Supported Scopes
add_filter( 'wo_scopes', 'wo_custom_scopes_filter_function' );
function wo_custom_scopes_filter_function( $scopes ) {
// your scopes you want to add
$my_scopes = array( 'scope1', 'scope2' );
$new_scopes = array_merge( $scopes, $my_scopes );
return $new_scopes;
}