Comments (5)
Thanks for the report!
Indeed, when I create a new OAuth Client ID, I also get the same error message.
I found https://developers.google.com/identity/oauth2/web/guides/migration-to-gis#gis-popup-ux, but it doesn’t work for me for some reason I have yet to figure out… The popup dialog appears, but after logging in and granting access, nothing seems to happen: no error in the JavaScript developer tools, no requests arriving at the server.
I’ll take another look tomorrow.
from scan2drive.
I'm not sure of all the javascript features you are using. I started investigating and saw this quickstart which seems to not need any javascript to get a list of files and directories. Not sure if this would insulate the code from the everchanging javascript ecosystem. https://developers.google.com/drive/api/quickstart/go
from scan2drive.
The problem isn’t the Drive API itself, which we already use from Go.
The problem is the “sign in to google” functionality, which we need to get an access token to then access the Drive API from Go. This needs to remain JavaScript.
from scan2drive.
Sorry, maybe I'm missing something here, but it seems the example above would enable a redirect based oauth flow so no javascript is needed. The sample code generates a URL which when loaded in a browser presents the Google login screen. Once a successful login has occurred, the url redirects back to the provided redirect_url.
This may present problems based on the limitations google places on redirect_url, but one can fall back to copying the generated code in the URL into the app.
from scan2drive.
I pushed a branch with how far I got: https://github.com/stapelberg/scan2drive/commits/oauth — feel free to check it out, replace the hard-coded http://localhost:7120
everywhere and give it a shot.
I found https://developers.google.com/identity/oauth2/web/guides/migration-to-gis#gis-popup-ux, but it doesn’t work for me for some reason I have yet to figure out… The popup dialog appears, but after logging in and granting access, nothing seems to happen: no error in the JavaScript developer tools, no requests arriving at the server.
The issue was that I had only configured http://localhost:7120
as “Authorised JavaScript origins” in my Client ID. I also needed to add http://localhost
(without port) for the popup to work.
That said, we can’t use the implicit flow (with the popup), because it’s impossible to exchange an oauth2 token on the server side. For that, we need to use the redirect flow.
The “HTML API” (still using JavaScript in the background, just the developer doesn’t have to write JavaScript) only works for authN, not for authZ.
With the old library, authN and authZ were sort of mushed together, which was very convenient for tiny applications like this one.
With the new library, the idea seems to be that authN is the first step, and the app only does authZ where needed (e.g. when it actually wants to save a file), with granular fallback in case the user decides to grant only a subset of scopes. This is a good model for larger apps, but rather complicated for scan2drive, so I’m not sure it’s worth trying to implement that. The only advantage we would get is that the consent dialog would be a little more clear (no checkbox that the user can forget to tick).
from scan2drive.
Related Issues (20)
- race condition: setup mode redirect might run into transient HTTP 404
- main.go:846: undefined: s HOT 2
- add zoom function to scan thumbnails
- fix UI-driven scanning/renaming HOT 5
- Add upspin server availing scans HOT 1
- create thumbnails asynchronously for button-triggered scans HOT 1
- Which scanners does it support? HOT 2
- eSCL (“AirScan”) support HOT 1
- neonjpeg-created images cannot be loaded by Go HOT 4
- Consider supporting other authentication providers and sinks
- scan2drive.zekjur.net https listener is currently hardcoded in the source HOT 1
- scan2drive doesn't append DNSSD Domain to scanner service for Avahi-style name resolution HOT 1
- Listen address/oauth redirect trouble HOT 3
- Support airscan-only operation on MacOS? HOT 3
- investigate using machine learning for OCR
- gokr-packer exiting with status 2 after `*grpc.ClientConn has no field or method State` HOT 1
- Investigate using ARM NEON instructions to speed up image processing HOT 6
- Unify internal/g3 with image/jpeg/writer.go
- Unable to read client secret file: open /perm/client_secret_... HOT 21
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scan2drive.