This page looks best with JavaScript enabled

Plexdrive problem: OAuth out-of-band (OOB)

 ·  🎃 kr0m

Lately, plexdrive has been having problems due to Google’s authentication change. You can read more about it in this link , but basically it is as follows:

OAuth out-of-band (OOB) is a legacy flow developed to support native clients which do not have a redirect URI like web apps to accept the credentials after a user approves an OAuth consent request. The OOB flow poses a remote phishing risk and clients must migrate to an alternative method to protect against this vulnerability. New clients will be unable to use this flow starting on Feb 28, 2022.

If we try to configure plexdrive, it will generate the URL where we must authorize access, but in the last step, Google will show us the following error:

Error 400: invalid_request
No puedes iniciar sesión en esta aplicación porque no cumple con la política OAuth 2.0 de Google destinada a mantener seguras las aplicaciones.
Puedes decirle al desarrollador que su aplicación no cumple una o varias reglas de validación de Google.

To temporarily solve it, we will manually compile the plexdrive source code by modifying a line while the plexdrive developer updates the project. The steps to follow are as follows:


vi drive/drive.go

                        //RedirectURL: "urn:ietf:wg:oauth:2.0:oob",
                        RedirectURL: "http://localhost:1/",

We compile it:

GO111MODULE=on go install

We will only run this modified binary to obtain or renew the “code”:

~/go/bin/plexdrive mount -o allow_other -v 3 –drive-id=123NN6pzdEfUgXXUk9123 /mnt/gdrive

It will output the auth URL, but when we grant permissions indicating the Google account, it will try to redirect us to http://localhost:1, giving an error, but in the URL we can see the code that interests us.

In the browser URL, we see the “code”:

http://localhost:1/?state=state-token&code=4/0AX123sdfFFrtsdfdofdgdfgytuiu554jjjGRUuUICD0btGPL56Eirrbsw4ciofgdfgbJ2-OtxBg4DDeDAQ&scope=https://www.googleapis.com/auth/drive
code=4/0AX123sdfFFrtsdfdofdgdfgytuiu554jjjGRUuUICD0btGPL56Eirrbsw4ciofgdfgbJ2-OtxBg4DDeDAQ

“We pass it to the plexdrive CLI and we’re done.”

If you liked the article, you can treat me to a RedBull here