so, in your iframe you have the user_id and the referer domain (which you should be able to link to the authorized api)
so you could do something like the following:
- have the external website do a request to your api first, passing the userID and their Api Secret
- your api will respond with a unique hash and saves this hash with the api_id and user_id into a table (allowed_iframes ?)
- the external website now shows an iframe to iframe.domain.com/user_id/{unique_hash}
Your website can now check if user_id and unique_hash belong to eachother, if not: throw an exception.
You wouldnt even need the user_id in the iframe's URL this way, just the unique hash (and make sure to remove the hash from the table after 1 day or so, or perhaps also the next time you get an API call to create an allowed iframe)