Video Indexer Render Project API not working - api

I am trying to render a project I created using the Video Indexer "Create Project" API call, but I am getting the following error:
{
"ErrorType": "USER_NOT_ALLOWED",
"Message": "Token is authorized to access only a video. Trace id: '6a0bd50f-d25e-405f-b853-86847c8a1bca"
}
I'm following the following steps from the API documentation:
Create a project:
https://api.videoindexer.ai/{location}/Accounts/{accountId}/Projects[?accessToken]
This returns the new project information and 200 Ok status code.
Get the project access token by sending a GET request to:
https://api.videoindexer.ai/Auth/{location}/Accounts/{accountId}/Projects/{projectId}/AccessToken[?allowEdit]
An access token is returned successfully.
Send a POST request to render the video:
https://api.videoindexer.ai/{location}/Accounts/{accountId}/Projects/{projectId}/render[?sendCompletionEmail][&accessToken]
** for the access token parameter, I am passing in the project access key in all cases
However, the documentation for this API doesn't specify the schema for the body of the call, so when I send an empty body, it returns the error:
{
"ErrorType": "USER_NOT_ALLOWED",
"Message": "Token is authorized to access only a video. Trace id: '6a0bd50f-d25e-405f-b853-86847c8a1bca"
}
I have also tried a different approach of calling the Project widget and using the "Render" button that the widget provides, but I can neither save nor render the videos that show up in the project.
My end goal is to be able to edit the videos and render the selected video ranges.
Any advice regarding this issue is welcome.

Rendering a project is an operation that requires access to other videos in your Video Indexer account (the videos that are included in the project).
Therefore, make sure you use an account access token (obtained with allowEdit=true) for step 3, or just use the same token you used to create the project from step 1.

Related

How to Get Access Token and Refresh Token from User Consent | Outlook Calendar Integration using authorize code and state

Hi I am facing issue when I am using graph API so I am using delegate Permission access on behalf of user and I am successfully able to get Code and state but after I try to get access token using code value in Postman and also using dot net core so 9i am getting error The request body must contain the following parameter: 'grant_type and here I also pass grant_type =authorization_code but still I am getting same error
Please any one help me how to get access token enter image description here
I have try Postman and also using code but I am getting same error
error_description": "AADSTS900144: The request body must contain the following parameter: 'grant_type'.\r\nTrace

How to achieve the Dropbox equivalent of long-lived token now that they're gone (dropbox-sdk-js, Meteor, React)

For a while now I've been using dropbopx-sdk-js in a Meteor application without any trouble.
My Meteor app simply uses Dropbox to fetch images to be used in product cards. These files are synced now and then and that's it. By synced what I mean is they are scanned, shared links created or obtained, and some info is then saved in Mongo (name, extension, path, public link)
End users do not remove nor add files, nor are the files related to an end user specific account.
To achieve this, I created (in the far past) an App in the Dropbox App Console, generated a permanent token, and used that token in my Meteor app to handle all the syncing.
Now I've tried to replicate that very same thing in a new similar project, but found that the permanent tokens have been recently deprecated and are no longer an option.
Now, checking Dropbox's Authentication Types it seems to me like "App Authentication"
"This type only uses the app's own app key and secret, and doesn't
identify a specific user or team".
is what I'm after. I can safely provide app key and secret in the server exclusively, as the client will never need those. The question is how do I achieve such kind of authentication? Or for that matter, how do I achieve an equivalent of the long-lived token for my app, ultimately meaning that end users don't actually need to know Dropbox is behind the scenes in any way (and they surely don't need dropbox accounts to use this app nor should be prompted with any Dropbox authentication page)
In the js-sdk examples repo, I only found this example using app key and secret. Yet afterwards it goes through the oauth process in the browser anyways. If I don't do the oauth part, I get an error
"error": {
"name": "DropboxResponseError",
"status": 409,
"headers": {},
"error": {
"error_summary": "path/unsupported_content_type/...",
"error": {
".tag": "path",
"path": {
".tag": "unsupported_content_type"
}
}
}
}
as a result of calling
dbx.filesListFolders({ path: '', recursive: true }):
If I replace the initialization of the dbx object with a generated token everything works out. However eventually the token expires and I'm back in square one.
Any ideas what may I be missing?
The short answer is:
You need to obtain a refresh-token. You can then use this token for as long as you want. But in order to get it is necessary to go through at least one oauth flow in the browser. Then capturing the generated refresh-token in the backend. Then store it and use it to initialize the API. So it's kind of "hacky" (IMO).
For example, you can use the mentioned example code, and log/store the obtained refresh token in this line (as per Greg's accepted answer in the forum). Then use that value as a constant to immediately call the setRefreshToken method (as done in that very same line) upon initialization.
The long answer is:
ClientId + Client secret are not enough to programmatically generate a refresh token.
Going through the oauth flow at least once is mandatory to obtain a refresh token
If you want to hide such flow from your clients, you'll need to do what the short answer says.
The intended flow of usage according to Dropbox is: each user access his own files. Having several users accessing a single folder is not officially supported.
The longer answer is:
Check out the conversation we had in the dropbox forum
I suggested to replace the "Generate Access Token" button in the console for a "Generate Refresh Token" button instead. At least it made sense to me according to what we discussed. Maybe if it gets some likes... ;).

Add parameter in Firebase Dynamic Link created thru console

I have an Expo/React Native app and I'm trying to implement Firebase Dynamic Links so that I can connect two users. So, user A would provide a dynamic link to user B. If user B doesn't have the app already installed, the link would send the user to App Store or Google Play for it to be installed. Once the installation is completed, the app would open up and retrieve user A's ID. If user B already has the app installed, the dynamic link would simply open the app and retrieve user A's ID.
Here's my question: if I define a dynamic link through the Firebase console, can I add parameters to it in my app? In other words, simply use the dynamic link on the console and add user A's ID to it.
Or if I need to send parameters that will depend on the user, do I need to generate them through the REST API?
I'm currently trying the REST API but keep getting 401 error. I simply make a POST call with the following request object to the https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key={MyWebAPIKey}. And here's my request object:
{
"dynamicLinkInfo": {
"domainUriPrefix": "https://dl.mydomain.com/link",
"link": "https://dl.mydomain.com/link?id=12345",
"androidInfo": {
"androidPackageName": "com.my-domain.myapp"
},
"iosInfo": {
"iosBundleId": "com.my-domain.myapp"
}
}
My https://dl.mydomain.com is hosted by Firebase and is used only for dynamic linking purposes and when I go to the Dynamic Links console, it shows
https://dl.mydomain.com/link as my URL prefix.
So, I'm trying to understand:
If I'll simply add a user ID as a parameter, can I use the dynamic link I create through the console or do I need to generate a dynamic link programmatically -- in my case through the REST API?
If I need to do it through the REST API, what am I doing wrong in my code?
PS: Interestingly, when I try the POST call to Shortlinks API using Postman, it actually works and gives me a shortlink. When I try the same thing in my Expo app, I get a 401 error.

Issues with retrieving profile image from Google Admin SDK/Directory API

I am trying to retrieve a user's profile picture in Python using either the users.get method or the users.photos.get method from the Google Directory API. I have set up my service account with the proper scope, and I get a 200 response when calling both endpoints, and can view actual data for every field, but when trying to access the profile image, I get a generic silhouette image. The methods I have used to try and access the profile images are:
With the users.get method, I have tried making a get call on the thumbnailPhotoUrl field using AuthorizedHttp under google.auth.transport.urllib3 from the Python google-auth package. The AuthorizedHttp object is created using the google service account credentials.
With the users.photos.get method I have tried decoding the photoData field with web-safe base64.
Most likely their photo is only linked to their Gmail account profile, which is inaccessible via the Admin API. You need to upload their photo directly through the admin.google.com GUI. Then your request will return that photo.

MS Graph API: microsoft.graph.createLink not creating anonymous view links

I'm using graph API to iterate over a folder in OneDrive for Business. I'm attempting to generate "anonymous view" links for each item in the folder using the following call:
/v1.0/users('user-guid')/drive/items/item-id/microsoft.graph.createLink
with the body:
{
"type": "view",
"scope": "anonymous"
}
This works correctly for items that have already been given the "View link- no sign-in required" permission via the OneDrive UI. However, executing this call against an item that doesn't have this sharing option already set, results in the following return message:
{
"error": {
"code": "unauthenticated",
"message": "The caller is not authenticated.",
"innerError": {
"request-id": "1c3600ec-4861-4be4-9a7b-74264f488a80",
"date": "2016-03-13T02:30:10"
}
}
}
I know that this is not an authentication issue because my token works fine for all other calls (and calls against items that already have their file sharing set). I get the same behavior from the Microsoft Graph Explorer tool. If I manually set the "View link - no sign-in required" permission in OneDrive this call executes perfectly. My credentials for the API call are the same credentials I'm using to set the permissions in the OneDrive UI.
The documentation for microsoft.graph.createLink states
The createLink method will create a new sharing link if the specified link type doesn't already exist. If a sharing link of the specified type already exists for the app, the existing sharing link will be returned.
Any ideas what's going wrong here?
The url should be simply /createLink (without the microsoft.graph prefix):
POST /me/drive/items/{item-id}/createLink