[squeak-dev] [Q] Using Google Drive from Linux
Edgar J. De Cleene
edgardec2005 at gmail.com
Thu Feb 8 09:25:13 UTC 2018
This is very useful, very thanks Paul
On 08/02/2018, 00:26, "Paul DeBruicker" <pdebruic at gmail.com> wrote:
> I was messing with accessing GMail from Pharo just today so some things
> I
learned that might help are:
1. Zinc has an OAuth2 implementation which is
> pretty easy to follow if you
need to port it to WebClient. Its in the package
> Zinc-SSO-OAuth2-Core. You
can load it into Pharo with
Metacello new
> configuration:'ZincHTTPComponents';
repository:
> 'github://svenvc/zinc/repository';
load:'SSO-OAuth2'.
The majority of the
> OAuth2 process is making/sending the correct URL to for
Google and then
> parsing their post-authorization JSON response in your
image.
For "testing"
> purposes/private use you can tell them to redirect to
> e.g.
http://localhost:8080/myGoogleOAuth2Callback after you've authorized
> your
account's permissions. You'll need to have a webserver listening at that
> url
(or whichever one you choose at the localhost domain) in the image for
> the
initial authorization. That should be sufficient for just getting access
> to
your own drive. You can have WebClient (or Zinc...) make the proper
> URL,
copy that, paste it into a browser, and then after you authorize inside
> the
browser Google will redirect to
> http://localhost:8080/myGoogleOAuth2Callback
and send along some JSON. You
> can then use that JSON to get an access
token.
If you want to create a
> public service its more complicated in that you'll
need to verify your domain
> ownership and then have them vet your
application. But it doesn't sound like
> that is what you want to do.
Because you're going to be using it on and off
> set your 'access_type' to
'offline' and then they'll send you a
> 'refresh_token' you can use to
re-authorize your app without user
> intervention. Their access tokens expire
after an hour, so you'll need to
> refresh them irregularly.
The 'refresh_token' is only available the first
> time your Google account is
authorized against your app (e.g. during the first
> request/response cycle &
never again....). If you miss it because you're
> just messing a bout
testing stuff & their JSON response doesn't include it add
> the
'prompt=consent' query parameter pair to your authorization URL and
> they'll
reset your account for your app and resend the refresh token. That
> one took
me waayyyyy tooooo long to figure out today .
If you hit issues
> I'll try to help but haven't done anything with the drive
API. They seem to
> be good about giving easily google-able error messages
when things get
> wonk.
Hope this helps.
Paul
Edgar J. De Cleene-3 wrote
> I wish use my
> Google Drive from inside Squeak
> I cook a Ubuntu Mate presistent pen drive so
> if I could accses Google
> Drive,
> could have a kind of small portatil
> computer.
>
> Feedback ?
>
> Thanks in advance.
>
> Edgar
>
> @morplenauta
--
Sent from: http://forum.world.st/Squeak-Dev-f45488.html
More information about the Squeak-dev
mailing list
|