You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to provide a secure method of connecting sites to MyYoast we want to be able to configure an OAuth Client for the purpose of retrieving access tokens.
Prefix the library as is already done for ruckusing and idiorm ( see composer.json and the config/php-scoper/ directory ).
Create a Yoast\WP\Free\OAuth\Client class, suggested path: src/oauth/client.php.
This class should have static methods to do the following:
save_configuration( $config ): Intended for storing client ID and secret. Should store partial configs ( just the ID or just the secret, leaving other values as they are ). If the plugin is network activated these should be stored on a network level, otherwise on a site level.
get_configuration(): Retrieve stored configuration, same constraints as above.
has_configuration(): Returns true if both a client ID and secret have been stored.
save_access_token( $user_id, $access_token ): Should store the access token and associated user ID. Should be stored so it is easily retrievable without knowing the user ID.
get_access_token( $user_id = null ): Should retrieve a stored access token. If a user ID is passed it should be an access token associated with that user ID, otherwise any stores access token.
get_provider(): Returns a new instance of \League\OAuth2\Client\Provider\GenericProvider configured with the stored client_id and secret. For the other values:
redirectUri: home_url( 'yoast/oauth/callback' ). If network activated then network_home_url( 'yoast/oauth/callback' ).
In order to provide a secure method of connecting sites to MyYoast we want to be able to configure an OAuth Client for the purpose of retrieving access tokens.
To do so the following is required:
config/php-scoper/directory ).Yoast\WP\Free\OAuth\Clientclass, suggested path:src/oauth/client.php.This class should have static methods to do the following:
save_configuration( $config ): Intended for storing client ID and secret. Should store partial configs ( just the ID or just the secret, leaving other values as they are ). If the plugin is network activated these should be stored on a network level, otherwise on a site level.get_configuration(): Retrieve stored configuration, same constraints as above.has_configuration(): Returns true if both a client ID and secret have been stored.save_access_token( $user_id, $access_token ): Should store the access token and associated user ID. Should be stored so it is easily retrievable without knowing the user ID.get_access_token( $user_id = null ): Should retrieve a stored access token. If a user ID is passed it should be an access token associated with that user ID, otherwise any stores access token.get_provider(): Returns a new instance of\League\OAuth2\Client\Provider\GenericProviderconfigured with the stored client_id and secret. For the other values:redirectUri:home_url( 'yoast/oauth/callback' ). If network activated thennetwork_home_url( 'yoast/oauth/callback' ).urlAuthorize:https://yoast.com/login/oauth/authorizeurlAccessToken:https://yoast.com/login/oauth/tokenurlResourceOwnerDetails:https://my.yoast.com/api/sites/currentparent #12136