Android Google Drive API v2 downloadUrl with access token stopped working-ThrowExceptions

Exception or error:

My app used to play Google Drive videos using v2’s downloadUrl() + access_token

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(videoItem.downloadUrl() + "&access_token=" + mAccessToken), "video/avi");
startActivity(intent);

However, it stops working one day for no apparent reason.

I have tried using v3’s webContent()

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(videoItem.webContent()));
startActivity(intent);

But this way they will need to log in Google on the device they are viewing the video from.

Does anyone know why v2’s downloadUrl() + access_token stops working?
Also why doesn’t the following works? Since I want to play my videos in a third party player no in Google Drive app.

intent.setDataAndType(Uri.parse(videoItem.webContent()), "video/avi");

Thank you in advance.

How to solve:

Yes, downloadUrl() + access_token stopped working on January 1, 2020, because of recent changes for the authorization for Google Drive API

Follow the new procedure as described in the documentation, basically

you will need to migrate your requests to authenticate using an HTTP
header

Leave a Reply

Your email address will not be published. Required fields are marked *