So I like to use the vimeo API in a WordPress plugin.
Its seems to me there are actually 3 different ways how to do this.
So my guess is that I could setup my website with video as 'master' application and through their complicated authorization process let users authenticate my app to do things. I am not sure how this exactly works ...
Because I plan to use this commercially I would have to register my plugin as a commercial application with video. Not that I expect to be rejected by them but I like the idea of my users have their own sites be their own application even if this means longer setup for them.
I have seen one plugin (codeflavors vimeo post Lite) offer settings for client id
and client secret
to the user and then does a request to get a API token specific for the user so basically every user has their own app registered on vimeo.
/**
* Constructor, fires up the parent by providing it with
* client ID, secret and token, if any
*/
public function __construct( $args = array() ){
// set plugin settings
$this->settings = cvm_get_settings();
// set the token
$token = null;
if( !empty( $this->settings['oauth_secret'] ) ){
$token = $this->settings['oauth_secret'];
}else if( !empty( $this->settings['oauth_token'] ) ){
$token = $this->settings['oauth_token'];
}
// set up redirect URL
$redirect_url = admin_url( 'edit.php?post_type=' . cvm_get_post_type() . '&page=cvm_settings' );
// start the parent
parent::__construct( $this->settings['vimeo_consumer_key'], $this->settings['vimeo_secret_key'], $token, $redirect_url );
I do not understand this part of their code, the part where the token is either a oauth_secret or a oauth_token
But I actually already integrated their code ignoring that oauth_secret part so users can generate their token in the WP Admin page if my plugin when they put their vimeo secret and id in.
But now I found 2 other plugins that seem to just use tokens.
define( 'VIMEOGRAPHY_ACCESS_TOKEN', 'eaf47146f04b5550a3e394f3bbf8273f');
they have their token just public-ally in their code. Is this intended to be used this way?
I also found out in the Vimeo app setup that you can generate a token right there. "Generate a token for script or testing". And I seen yet another plugin instructing users to generate their token there and drop that token in the WP Admin page.
So I am a bit confused but my guess is I could just use my own token for public data and when users need private data I could just instruct then to generate their own token and use that and actually skip all this complicated authorization stuff. Even though there is a official api for it to me its seems simpler and easier to maintain to just let them use a token like a api key for other APIs.
So my question is am I right about this. And what are the advantages to going the complicated route. If I can just let my users generate their own tokens?