nodejs-local-auth icon indicating copy to clipboard operation
nodejs-local-auth copied to clipboard

Print auth URL in case the code fails to open default browser

Open nmlynch94 opened this issue 1 year ago • 0 comments

What would you like to see in the library?

When calling authenticate, it attempts to open a browser to authorize the google application to access your data. However, in my case for some reason it was failing to open my browser on Fedora 41. There were no errors in the logs and it just hangs, presumably waiting for the user to interact with the browser.

I would like to print the auth URL as a fallback that can be copied into the browser. In my case, I modified index.js to be:

            // open the browser to the authorize url to start the workflow
            const authorizeUrl = client.generateAuthUrl({
                redirect_uri: redirectUri.toString(),
                access_type: 'offline',
                scope: scopes.join(' '),
            });
            console.log("URL: " + authorizeUrl)

nmlynch94 avatar Jan 22 '25 04:01 nmlynch94