Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Private video returning nil #202

Open
rodrigodeplcampos opened this issue Jul 11, 2016 · 4 comments
Open

Private video returning nil #202

rodrigodeplcampos opened this issue Jul 11, 2016 · 4 comments

Comments

@rodrigodeplcampos
Copy link

rodrigodeplcampos commented Jul 11, 2016

I'm trying to use the iOS native library to access my private video but is returning nil. I have a PRO account and i'm using this code:

VIMSessionConfiguration *config = [[VIMSessionConfiguration alloc] init];
config.clientKey = VIMEO_CLIENT_ID;
config.clientSecret = VIMEO_CLIENT_SECRET;
config.scope = VIMEO_SCOPE;
config.keychainService = @"your_service";

[VIMSession setupWithConfiguration:config];

[[VIMSession sharedSession] authenticateWithClientCredentialsGrant:^(NSError *error) {

if (error == nil)
{
NSLog(@"Success!");

[[VIMSession sharedSession].client requestURI:@"/videos/MY_PRIVATE_VIDEO_ID" completionBlock:^(VIMServerResponse *response, NSError *error) {

id JSONObject = response.result;
NSLog(@"JSONObject: %@", JSONObject);

}];
}
else
{
NSLog(@"Failure: %@", error);
}

@alfiehanssen
Copy link
Contributor

@rodrigodeplcampos

It looks like you're using the wrong authentication mechanism. You're using "client credentials grant", but this does not authenticate you as a user. Instead, this is the auth mechanism used in order to interact with public content in the Vimeo ecosystem. It's like browsing the Vimeo iOS app or website while logged out. You wont see any private content.

See this answer here: vimeo/VimeoUpload#104

@skywalkerlw
Copy link

Yes, i have the same situation here and it only works with "OAuth authorization code grant".

However, i have to say, the document does not well describe it and it tricks me so much especially when he has purchased a Pro version for development(want to make an app to playback all Vimeo videos) :(

By the way, I didn't see any benefit of Pro version from the view of development since ihe can only see his own created video playback urls via VIMNetworking and it's useless of that urls if he can not share with others (I guess the token in the playback urls could expire).

@VivekGoswami
Copy link

So how to get private video by this authentication? Because documentation doesn't well explain so it's confusing where should we authenticate and used.

@VivekGoswami
Copy link

I am trying with this below code for video, I get response but when i open embed code in webview they asking for login

let headers = ["Authorization": "Bearer TOKEN"
        ]
        Alamofire.request("https://api.vimeo.com/videos/VIDEO_ID", method: .get, parameters: [:], headers: headers).responseJSON { response in
            
            switch(response.result) {
            case .success(_):
                if response.result.value != nil{
                    print(response.result.value!)
                    let json = JSON(response.data!)
                    let embed = json["embed"]["html"].stringValue
                        print(json["uri"].stringValue)
                    self.webV.loadHTMLString(embed, baseURL: nil)

                }
                break
            case .failure(_):
                print(response.result.error!)
                break
            }
        }

simulator screen shot 12-sep-2017 7 26 41 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants