Uploading Video returns "Access Token validation failed"

import requests subscription_key = "enter key here" AID = "enter your account id here" #Creates an Account token def createAccountToken(): paramAccountToken = { 'location': 'trial', 'accountId': AID, 'allowEdit': True } headersAccountToken = { 'Ocp-Apim-Subscription-Key': subscription_key } get_account_token_URL = "https://api.videoindexer.ai/auth/trial/Accounts/" + AID + "/AccessToken?allowEdit=True" responseGetAccountToken = requests.get(get_account_token_URL,params = paramAccountToken, headers = headersAccountToken) parsedGetAccountToken = responseGetAccountToken.json() print(parsedGetAccountToken) return parsedGetAccountToken #upload video def uploadVideo(token): videoName = input("Enter Video title:") paramsUploadVideo = { 'location': 'trial', 'accountId': AID, 'name': videoName, 'accessToken': token } headersUploadVideo = { 'Content-Type': 'multipart/form-data' } url = "https://api.videoindexer.ai/trial/Accounts/"+AID+"/Videos?name="+videoName+"&accessToken=" + token + "&privacy=Private&indexingPreset=Default&streamingPreset=Default&sendSuccessEmail=False" videofile = open("sampleclip.mov", "rb") responseUploadVideo = requests.post(url, data = videofile, headers = headersUploadVideo, params = paramsUploadVideo) parsedUploadVideo = responseUploadVideo.json() print(parsedUploadVideo) accToken = createAccountToken() uploadVideo(accToken) #The code above successfully creates an account access token, but when using that same token to upload the video, #it sends the following response #{'ErrorType': 'ACCESS_TOKEN_VALIDATION_FAILED', 'Message': 'Access token validation failed.'}

Attachments

Comments

  •  
    The code above successfully creates an account access token, but when using that same token to upload the video, it sends the following response #{'ErrorType': 'ACCESS_TOKEN_VALIDATION_FAILED', 'Message': 'Access token validation failed.'}
    Posted by Hidden Sun, 14 Apr 2019 04:04:48 GMT
  •  
    hi, can you contact us at visupport@microsoft.com and provide us with an example of an account token and an example of the upload url you are using? please make sure the token is over an hour old, so it won't be active anymore.
    Posted by Hidden Sun, 14 Apr 2019 04:53:44 GMT


You're not signed in. Please sign-in to report an issue or post a comment.