[Q] Using Google Drive from Linux

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Q] Using Google Drive from Linux

Edgar De Cleene
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





Reply | Threaded
Open this post in threaded view
|

Re: [Q] Using Google Drive from Linux

Tobias Pape

> On 07.02.2018, at 12:57, Edgar J. De Cleene <[hidden email]> 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 ?

Its all "REST" ->  https://developers.google.com/drive/v3/web/about-sdk

- You need HTTPS, OAuth2 (hence JSON and
- You must create an "application" with google at https://console.developers.google.com/ 
  (-> for client ID and secret)

The rest is in the docs: https://developers.google.com/drive/v3/web/about-files

Best regards
        -Tobias


>
> Thanks in advance.
>
> Edgar
> @morplenauta
>
>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: [Q] Using Google Drive from Linux

Edgar De Cleene
Thnks


On 07/02/2018, 10:19, "Tobias Pape" <[hidden email]> wrote:

>  On 07.02.2018, at 12:57, Edgar J. De Cleene <[hidden email]> 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 ?

Its all "REST" ->
> https://developers.google.com/drive/v3/web/about-sdk

- You need HTTPS, OAuth2
> (hence JSON and
- You must create an "application" with google at
> https://console.developers.google.com/ 
  (-> for client ID and secret)

The
> rest is in the docs:
> https://developers.google.com/drive/v3/web/about-files

Best
> regards
 -Tobias


>
> Thanks in advance.
>
> Edgar
> @morplenauta



Reply | Threaded
Open this post in threaded view
|

Re: [Q] Using Google Drive from Linux

Paul DeBruicker
In reply to this post by Edgar De Cleene
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

Reply | Threaded
Open this post in threaded view
|

Re: [Q] Using Google Drive from Linux

Edgar De Cleene
This is very useful, very thanks Paul


On 08/02/2018, 00:26, "Paul DeBruicker" <[hidden email]> 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