VIMNetworking icon indicating copy to clipboard operation
VIMNetworking copied to clipboard

Private video returning nil

Open rodrigodeplcampos opened this issue 9 years ago • 4 comments

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); }

rodrigodeplcampos avatar Jul 11 '16 22:07 rodrigodeplcampos

@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: https://github.com/vimeo/VimeoUpload/issues/104

alfiehanssen avatar Jul 14 '16 11:07 alfiehanssen

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).

skywalkerlw avatar Nov 25 '16 01:11 skywalkerlw

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 avatar Sep 12 '17 11:09 VivekGoswami

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

VivekGoswami avatar Sep 12 '17 13:09 VivekGoswami