WooCommerce REST API Consumer Key and Consumer Secret get deleted after successful authentication

Viewed 146

I'm able to authenticate users into my application according to the "Auto generating API keys using our Application Authentication Endpoint" documentation. The consumer key and consumer secret are generated and I get the JSON API Keys from the authentication URL. I can then make requests to WooCommerce. The problem I'm having is that the consumer key and consumer secret are auto deleted from the database unlike consumer keys and secrets generated through the WooCommerce admin.

I've noticed that once logged in through the app, the URL has the endpoint "/wc-auth/v1/access_granted/" which comes back with the parameter "wc_auth_nonce". Is that needed for the authentication in order for the key and secret to not be deleted?

The documentation only mentions four parameters being returned from the callback_url:

{
    "key_id": 1,
    "user_id": 123,
    "consumer_key": "ck_xxxxxxxxxxxxxxxx",
    "consumer_secret": "cs_xxxxxxxxxxxxxxxx",
    "key_permissions": "read_write"
}

And two parameters returned from the return_url which are success and user_id.

What am I missing in order to make the consumer key and secret remain in the database?

0 Answers
Related