wp-calypso icon indicating copy to clipboard operation
wp-calypso copied to clipboard

Marketplace: Product Licensing - Implement API authentication using API/Secret when calling get subscription information route

Open gavande1 opened this issue 2 years ago • 7 comments

Summary

Implement Basic Auth using API/Secret keys issues to vendors for validating if requests are valid and we need to protect API routes like getting subscription information.

Related to pdh6GB-1dL-p2#comment-1951

gavande1 avatar Jul 07 '22 11:07 gavande1

The API that needs to be authenticated is created as part of https://github.com/Automattic/wp-calypso/issues/65347

cpapazoglou avatar Jul 21 '22 13:07 cpapazoglou

Looks like this will require a new authentication method in rest-api-plugins/centralized/auth.php?

obenland avatar Jul 21 '22 18:07 obenland

It looks like authentication methods for the WP REST API resolve to a user account. Will we create/associate a wpcom user account with every vendor?

obenland avatar Jul 25 '22 19:07 obenland

Rather than adding a new authentication method to the API, could we generate an oauth client for each partner as they register? There is some prior art for Jetpack partners that we might take inspiration from? 2cf99-pb/#plain

obenland avatar Jul 25 '22 19:07 obenland

It looks like authentication methods for the WP REST API resolve to a user account. Will we create/associate a wpcom user account with every vendor?

Yes, each vendor will have a WC.com account which uses wpcom accounts. Yes we could look into using the vendor account for auth, I am just wondering if decoupling the vendor account from the system that requests subscription details would make sense. For example, a vendor could change their password and forget to change the auth details in their systems. Changing their API key (regenerating it) though, would make it more explicit that auth details have changed (they invoked the change) and they should update their systems.

cpapazoglou avatar Jul 26 '22 08:07 cpapazoglou

Diff created: D85549-code

gavande1 avatar Aug 08 '22 11:08 gavande1

Deployed r250526-wpcom

gavande1 avatar Aug 11 '22 10:08 gavande1