[Update] Zinc-SSO now supports Dropbox !

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

Re: [Update] Zinc-SSO now supports Dropbox !

Sven Van Caekenberghe-2
Sabine,

On 05 Feb 2013, at 14:45, Sabine Knöfel <[hidden email]> wrote:

> Hi Sven,
>
> great! The file was created in my dropbox account:-)

And it will be read, updated and written from now on, every time you run the demo.

> I will try to use it now in my application and will come back with questions if they occur.

Yesterday I used STON to serialize a ZnOAuth1DropboxUserAccess instance that was created from the demo web app demo.

To make such an instance you use the codes that were also needed to set up the web demo and the 2 part access token that the web app requested and was granted by the user. To access this token, you currently have to inspect/explore the sessions in the ZnServer instance (there will normally only be one) and assign it to the following object (this is all in hack/debug mode):

| data service |

data := ZnOAuth1ConsumerData newForDropbox
        consumer: 'vqzexpgl5rvzXXX';
        consumerSecret: '13uygcdbou8lXXX';
        yourself.
       
service := ZnOAuth1Service new
        providerAccount: data ;
        yourself.
       
ZnOAuth1DropboxUserAccess new
        oauth1Service: service;
        yourself.

(And send it #accessToken:).

This will give you a representation like this:

ZnOAuth1DropboxUserAccess {
        #oauth1Service : ZnOAuth1Service {
                #providerAccount : ZnOAuth1ConsumerData {
                        #getRequestTokenUrl : 'https://api.dropbox.com/1/oauth/request_token',
                        #authorizeTokenUrl : 'https://www.dropbox.com/1/oauth/authorize',
                        #getAccessTokenUrl : 'https://api.dropbox.com/1/oauth/access_token',
                        #consumer : 'vqzexpgl5rvzXXX',
                        #consumerSecret : '13uygcdbou8lXXX',
                        #accessTokenClass : nil
                }
        },
        #accessToken : ZnOAuth1Token {
                #value : 'qdcm6mivqesdXXX',
                #secret : '39w7r9wqamdgXXX',
                #sessionid : nil
        }
}

I don't know what the lifetime is of this, but from other apps using Dropbox I am guessing it must be pretty long, even close to infinite.
So one day later, with the demo web app long gone and image restarted, I can do this:

('ZnOAuth1DropboxUserAccess.ston' asFileReference
        readStreamDo: [ :in | STON fromString: in ]) getFile: #( 'demo.txt' ).

And it just works.

Now, we have to work out a way to make this flow easier and secure at the same time.

> Thank you very much.

We wrote this so that others can use it, so we are happy with other developers trying out our stuff.

Thanks for testing and for the feedback.

Sven

> Sabine
>
> On Mon, Feb 4, 2013 at 12:52 PM, Sven Van Caekenberghe <[hidden email]> wrote:
>
> On 30 Jan 2013, at 19:13, Sven Van Caekenberghe <[hidden email]> wrote:
>
> > On 30 Jan 2013, at 18:32, Sabine Knöfel <[hidden email]> wrote:
> >
> >> Sven,
> >>
> >> could you provide a simple code fragment which shows how to write and how to read a file from the smalltalk image to the connected dropbox app folder?
> >
> > The whole API is not (yet) implemented.
> >
> >  https://www.dropbox.com/developers/reference/api
> >
> > Have a look at ZnOAuth1TwitterUserAccess.
> >
> > If I find more time, I might try myself.
> >
> > GET is pretty straightforward, for PUT or POST you will have to supply a ZnEntity of a specific mime-type with bytes or a string.
> >
> > Note that for file access the host is different.
>
> I added a bit more Dropbox API and a little demo accessing files.
>
> There is now #manipulateDemoFile: which will try to access a file called 'demo.txt' and read an id out of it. If found the file is written again, with the id increased and some other fields updated as well. If the file did not exist, it is created with id 1. All this happens automatically if you access /sso-dropbox and log in. You'll get the updated id in the web page and you'll see your Dropbox client doing a local update immediately!
>
> Here are the details (http://mc.stfx.eu/Zinc-HTTP-Components):
>
> ---
> Name: Zinc-SSO-OAuth1-Core-SvenVanCaekenberghe.13
> Author: SvenVanCaekenberghe
> Time: 4 February 2013, 12:27:12.196 pm
> UUID: 3d78a965-462e-4a4e-94aa-1779369aecb8
> Ancestors: Zinc-SSO-OAuth1-Core-SvenVanCaekenberghe.12
>
> extended ZnOAuth1Service with #httpDelete:using: #httpPost:with:using: #httpPut:with:using:
> extended ZnOAuth1DropboxUserAccess with #getFile: and #putFile:data:
> some refactoring in ZnOAuth1DropboxUserAccess
> ---
> Name: Zinc-SSO-Demo-SvenVanCaekenberghe.5
> Author: SvenVanCaekenberghe
> Time: 4 February 2013, 12:28:14.601 pm
> UUID: 4bb17785-f885-4db5-98f5-9c7d52d3add6
> Ancestors: Zinc-SSO-Demo-SvenVanCaekenberghe.4
>
> added ZnSSOServerDelegate>>#manipulateDemoFile:
> ---
>
> This should get you started.
>
> Note that it is not necessary to log in each time: the access token is valid until you get an unauthorized response.
> With the access token and the consumer data you can create service objects separate from the web app that did the setup.
>
> HTH,
>
> Sven
>
>
> >> Greetings
> >> Sabine
> >>
> >> On Wed, Jan 30, 2013 at 6:00 PM, Sabine Knöfel <[hidden email]> wrote:
> >> Hi Sven,
> >>
> >> there was only missing loading Zodiac, the dll (windows) was already included in the 1 klick image.
> >>
> >> Gofer it
> >>  squeaksource: 'Zodiac';
> >>  package: 'Zodiac-Core';
> >>  package: 'Zodiac-Tests';
> >>  load.
> >>
> >> It works. I play around now.
> >> Thank you very much!
> >> Sabine
> >>
> >>
> >> On Wed, Jan 30, 2013 at 5:38 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> >>
> >> On 30 Jan 2013, at 17:21, Sabine Knöfel <[hidden email]> wrote:
> >>
> >>> Hi Sven, hi Jan,
> >>>
> >>> thank you.
> >>> I am one step further now but there must be something else missing to load.
> >>> I failed with my current image, so I tried the following:
> >>>
> >>> I took a fresh image - the Pharo 1.4. one click app from the pharo homepage
> >>> (http://gforge.inria.fr/frs/download.php/31258/Pharo-1.4-14557-OneClick.zip)
> >>>
> >>> Then I loaded seaside 3.0 (from the welcome screen - MetacelloConfigurationBrowser open).
> >>>
> >>> After that, I loaded
> >>>
> >>> Gofer it
> >>>  url: 'http://mc.stfx.eu/ZincHTTPComponents';
> >>>  package: 'ConfigurationOfZincHTTPComponents';
> >>>  load.
> >>>
> >>> And then the bleeding Edge version
> >>> ConfigurationOfZincHTTPComponents project bleedingEdge load: 'SSO'.
> >>>
> >>> Then this was possible:
> >>> (ZnServer startDefaultOn: 8100)
> >>>        logToTranscript;
> >>>        debugMode: true;
> >>>        delegate: (ZnSSOServerDelegate new
> >>>                dropboxData: (ZnOAuth1ConsumerData newForDropbox
> >>>                                                                consumer: 'my appdata';
> >>>                                                                consumerSecret: 'my appdata';
> >>>                                                                yourself);
> >>>                yourself).
> >>>
> >>> No I tried in my browser
> >>> localhost:8100/sso-dropbox
> >>>
> >>> Then I got a walkback in my Image: No secure socket stream class set or available
> >>
> >> Well, the error says it all: you need TLS/SSL support. As is noted in
> >>
> >>  https://github.com/svenvc/docs/blob/master/zinc/zinc-sso-paper.md#installation
> >>
> >> You can get Zodiac to work in 1.4
> >>
> >>  http://zdc.stfx.eu
> >>
> >> Don't forget that you also need the plugin next to your VM !
> >>
> >> In Pharo 2.0 Zodiac is included by default the latest VM's there should have the plugin.
> >> But in 2.0 it will be slightly more difficult to load Seaside, but it does work.
> >>
> >> Sorry, but all this is still a bit in motion, hopefully you will keep trying.
> >>
> >>> ==>> I do not have the class ZdcSecureSocketStream in my Image
> >>> self secureSocketStreamClass is Nil in
> >>>
> >>> streamClassForScheme: scheme
> >>>    (#(http ws) includes: scheme) ifTrue: [
> >>>        ^ self socketStreamClass ].
> >>>    (#(https wss) includes: scheme) ifTrue: [
> >>>        ^ self secureSocketStreamClass ifNil: [
> >>>            self error: 'No secure socket stream class set or available' ] ].
> >>>    (ZnUnknownScheme scheme: scheme) signal
> >>>
> >>> Can you tell me what is missing to load?
> >>>
> >>> Greetings
> >>> Sabine
> >>>
> >>>
> >>> 30 January 2013 5:14:22.402 pm
> >>>
> >>> ZnNetworkingUtils(Object)>>error:
> >>>    Receiver: a ZnNetworkingUtils
> >>>    Arguments and temporary variables:
> >>>        aString:     'No secure socket stream class set or available'
> >>>    Receiver's instance variables:
> >>>        socketStreamClass:     SocketStream
> >>>        secureSocketStreamClass:     nil
> >>>
> >>> ZnNetworkingUtils>>streamClassForScheme:
> >>>    Receiver: a ZnNetworkingUtils
> >>>    Arguments and temporary variables:
> >>>        scheme:     #https
> >>>    Receiver's instance variables:
> >>>        socketStreamClass:     SocketStream
> >>>        secureSocketStreamClass:     nil
> >>>
> >>> ZnNetworkingUtils>>socketStreamToUrlDirectly:
> >>>    Receiver: a ZnNetworkingUtils
> >>>    Arguments and temporary variables:
> >>>        url:     https://api.dropbox.com/1/oauth/request_token
> >>>        stream:     nil
> >>>        address:     #[199 47 218 158]
> >>>    Receiver's instance variables:
> >>>        socketStreamClass:     SocketStream
> >>>        secureSocketStreamClass:     nil
> >>>
> >>> ZnNetworkingUtils>>socketStreamToUrl:
> >>>    Receiver: a ZnNetworkingUtils
> >>>    Arguments and temporary variables:
> >>>        url:     https://api.dropbox.com/1/oauth/request_token
> >>>    Receiver's instance variables:
> >>>        socketStreamClass:     SocketStream
> >>>        secureSocketStreamClass:     nil
> >>>
> >>>
> >>>
> >>>
> >>> On Wed, Jan 30, 2013 at 4:37 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> >>> Sabine,
> >>>
> >>> On 30 Jan 2013, at 16:24, Sabine Knöfel <[hidden email]> wrote:
> >>>
> >>>> Hi Sven,
> >>>>
> >>>> after loading:
> >>>>
> >>>> Gofer it
> >>>>  url: 'http://mc.stfx.eu/ZincHTTPComponents';
> >>>>  package: 'ConfigurationOfZincHTTPComponents';
> >>>>  load.
> >>>>
> >>>> ConfigurationOfZincHTTPComponents project latestVersion load: 'SSO'.
> >>>>
> >>>> The ZnOAuth1ConsumerData does not have a method called >>newForDropbox (but >>newForGoogle and >>newForTwitter).
> >>>> Also, ZnSSOServerDelegate does not have a method >>dropboxData: (but facebook, twittter and google)
> >>>>
> >>>> Did I miss something?
> >>>
> >>> Yes and no. The latest stable version of the configuration does not yet include the Dropbox code.
> >>> The following will load what is called bleedingEdge, the very latest version of everything, regardless of its release status.
> >>>
> >>>  ConfigurationOfZincHTTPComponents project bleedingEdge load: 'SSO'.
> >>>
> >>> Sorry about that.
> >>>
> >>> Sven
> >>>
> >>>> Greetings
> >>>> Sabine
> >>>>
> >>>>
> >>>> On Sun, Jan 27, 2013 at 8:47 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> >>>>
> >>>> On 27 Jan 2013, at 13:32, Sven Van Caekenberghe <[hidden email]> wrote:
> >>>>
> >>>>> If anyone is interested, I can write another email explaining how you can run this demo for yourself on your own account.
> >>>>
> >>>> How to run the Dropbox code yourself:
> >>>>
> >>>> 1. Get yourself a free Dropbox account at http://www.dropbox.com
> >>>>
> >>>> 2. Install some client software on one or more of your computers (Mac, Windows, Linux) or devices (iOS [iPhone, iPad, iPod], Android, BlackBerry, Kindle Fire) and move some files around to get a feel for the service.
> >>>>
> >>>> 3. When you give other applications access to (part of) your Dropbox files, you can check that at https://www.dropbox.com/account#applications
> >>>>
> >>>> 4. Define your own app that will try to access Dropbox files. Go to https://www.dropbox.com/developers (Developer home) and start defining a new app by clicking the 'Create an app' button at https://www.dropbox.com/developers/apps - start with the access type 'App folder'.
> >>>>
> >>>> 5. The two important elements you need are the 'App key' and 'App secret', make sure to copy them correctly.
> >>>>
> >>>> 6. Get the very latest code in your image (we develop in Pharo 2.0, but 1.4 or even 1.3 should work - SSL has to be fully operational).
> >>>>
> >>>> Gofer it
> >>>>  url: 'http://mc.stfx.eu/ZincHTTPComponents';
> >>>>  package: 'ConfigurationOfZincHTTPComponents';
> >>>>  load.
> >>>>
> >>>> ConfigurationOfZincHTTPComponents project latestVersion load: 'SSO'.
> >>>>
> >>>> 7. Start a Zn server with an appropriate delegate, configured for your app
> >>>>
> >>>> (ZnServer startDefaultOn: 8100)
> >>>>        logToTranscript;
> >>>>        debugMode: true;
> >>>>        delegate: (ZnSSOServerDelegate new
> >>>>                dropboxData: (ZnOAuth1ConsumerData newForDropbox
> >>>>                                                                consumer: 'vqz-app-key-zoca';
> >>>>                                                                consumerSecret: '13u-app-secret-8l006';
> >>>>                                                                yourself);
> >>>>                yourself).
> >>>>
> >>>> (The above is a demo setup limited to Dropbox, the other demos are not configured and won't work).
> >>>>
> >>>> 8. Go to http:://localhost:8100/sso-dropbox and click the link to log in - you will be transferred to Dropbox to log in (if you aren't already) and asked to authorise your demo app, after which Dropbox will redirect you back to your app.
> >>>>
> >>>> 9. Once back in your app, sso-dropbox-callback (#ssoDropboxCallback:) will access your account info and list the app root folder, which will then be shown.
> >>>>
> >>>> 10. For the rest of the API, (currently not yet implemented), see https://www.dropbox.com/developers/reference/api - you don't have to worry about the whole authentication thanks to Zinc-SSO.
> >>>>
> >>>> We would love for others to try this (as well as the other Zinc-SSO options, Google, Facebook, Twitter) out, in their own projects, and to provide actual feedback and generally help improve the code and documentation.
> >>>>
> >>>> As always, May the Source be with you!
> >>>>
> >>>> Sven
> >>>>
> >>>> PS: The demo app is not (yet) a production app: only you and up to 5 explicitly listed users can use it. You have to apply for production status later on. Also, the whole ZnSSOServerDelegate code is a demo, for an actual project, it would be best to extract the necessary parts out of it, reusing the underlying Zinc-SSO-OAuth1-Core framework.
> >>>>
> >>>> --
> >>>> Sven Van Caekenberghe
> >>>> http://stfx.eu
> >>>> Smalltalk is the Red Pill
> >>>>
> >>>>
>


Reply | Threaded
Open this post in threaded view
|

Re: [Update] Zinc-SSO now supports Dropbox !

Sabine Manaa
Hi Sven,

I created the ZnOAuth1DropboxUserAccess with the ZnOAuth1Service and ZnOAuth1ConsumerData instances in it. Then I assigned the accessToken from an inspector.

That worked. I was able to read the file from the dropbox with getFile:. Great!

I used that code (please note "STON fromString: in contents asString ")

save the ZnOAuth1DropboxUserAccess as file:
(Path * 'plonk.txt') asFileReference
    fileStreamDo: [ :stream |
        STON put: self onStreamPretty: stream ].

Read and create the ZnOAuth1DropboxUserAccess  instance and then get contents of the demo file
((Path * 'plonk.ston') asFileReference
        readStreamDo: [ :in | STON fromString: in contents asString    ]) getFile: #( 'demo.txt' ).

This is fine.
My next question is how can I create an instance of ZnOAuth1Token from WITHIN my application?

When I need this ZnOAuth1Token, I am in a subclass of WAComponent.
I don't want the user to click at a link like localhost:8100/sso-dropbox.

Clicking at a button within my application should send the user directly to the dropbox page to grant access and create the ZnOAuth1Token.

Cold you perhaps create a small code example like this

renderContentOn: method

    html anchor
        script: html jQuery this button;
        url: '???http://localhost:8100/sso-dropbox???';
        with: 'send me to dropbox, create ZnOAuth1Token and return it in some way'. 

Greetings
Sabine




On Tue, Feb 5, 2013 at 5:22 PM, Sven Van Caekenberghe <[hidden email]> wrote:
Sabine,

On 05 Feb 2013, at 14:45, Sabine Knöfel <[hidden email]> wrote:

> Hi Sven,
>
> great! The file was created in my dropbox account:-)

And it will be read, updated and written from now on, every time you run the demo.

> I will try to use it now in my application and will come back with questions if they occur.

Yesterday I used STON to serialize a ZnOAuth1DropboxUserAccess instance that was created from the demo web app demo.

To make such an instance you use the codes that were also needed to set up the web demo and the 2 part access token that the web app requested and was granted by the user. To access this token, you currently have to inspect/explore the sessions in the ZnServer instance (there will normally only be one) and assign it to the following object (this is all in hack/debug mode):

| data service |

data := ZnOAuth1ConsumerData newForDropbox
        consumer: 'vqzexpgl5rvzXXX';
        consumerSecret: '13uygcdbou8lXXX';
        yourself.

service := ZnOAuth1Service new
        providerAccount: data ;
        yourself.

ZnOAuth1DropboxUserAccess new
        oauth1Service: service;
        yourself.

(And send it #accessToken:).

This will give you a representation like this:

ZnOAuth1DropboxUserAccess {
        #oauth1Service : ZnOAuth1Service {
                #providerAccount : ZnOAuth1ConsumerData {
                        #getRequestTokenUrl : 'https://api.dropbox.com/1/oauth/request_token',
                        #authorizeTokenUrl : 'https://www.dropbox.com/1/oauth/authorize',
                        #getAccessTokenUrl : 'https://api.dropbox.com/1/oauth/access_token',
                        #consumer : 'vqzexpgl5rvzXXX',
                        #consumerSecret : '13uygcdbou8lXXX',
                        #accessTokenClass : nil
                }
        },
        #accessToken : ZnOAuth1Token {
                #value : 'qdcm6mivqesdXXX',
                #secret : '39w7r9wqamdgXXX',
                #sessionid : nil
        }
}

I don't know what the lifetime is of this, but from other apps using Dropbox I am guessing it must be pretty long, even close to infinite.
So one day later, with the demo web app long gone and image restarted, I can do this:

('ZnOAuth1DropboxUserAccess.ston' asFileReference
        readStreamDo: [ :in | STON fromString: in ]) getFile: #( 'demo.txt' ).

And it just works.

Now, we have to work out a way to make this flow easier and secure at the same time.

> Thank you very much.

We wrote this so that others can use it, so we are happy with other developers trying out our stuff.

Thanks for testing and for the feedback.

Sven

> Sabine
>
> On Mon, Feb 4, 2013 at 12:52 PM, Sven Van Caekenberghe <[hidden email]> wrote:
>
> On 30 Jan 2013, at 19:13, Sven Van Caekenberghe <[hidden email]> wrote:
>
> > On 30 Jan 2013, at 18:32, Sabine Knöfel <[hidden email]> wrote:
> >
> >> Sven,
> >>
> >> could you provide a simple code fragment which shows how to write and how to read a file from the smalltalk image to the connected dropbox app folder?
> >
> > The whole API is not (yet) implemented.
> >
> >  https://www.dropbox.com/developers/reference/api
> >
> > Have a look at ZnOAuth1TwitterUserAccess.
> >
> > If I find more time, I might try myself.
> >
> > GET is pretty straightforward, for PUT or POST you will have to supply a ZnEntity of a specific mime-type with bytes or a string.
> >
> > Note that for file access the host is different.
>
> I added a bit more Dropbox API and a little demo accessing files.
>
> There is now #manipulateDemoFile: which will try to access a file called 'demo.txt' and read an id out of it. If found the file is written again, with the id increased and some other fields updated as well. If the file did not exist, it is created with id 1. All this happens automatically if you access /sso-dropbox and log in. You'll get the updated id in the web page and you'll see your Dropbox client doing a local update immediately!
>
> Here are the details (http://mc.stfx.eu/Zinc-HTTP-Components):
>
> ---
> Name: Zinc-SSO-OAuth1-Core-SvenVanCaekenberghe.13
> Author: SvenVanCaekenberghe
> Time: 4 February 2013, 12:27:12.196 pm
> UUID: 3d78a965-462e-4a4e-94aa-1779369aecb8
> Ancestors: Zinc-SSO-OAuth1-Core-SvenVanCaekenberghe.12
>
> extended ZnOAuth1Service with #httpDelete:using: #httpPost:with:using: #httpPut:with:using:
> extended ZnOAuth1DropboxUserAccess with #getFile: and #putFile:data:
> some refactoring in ZnOAuth1DropboxUserAccess
> ---
> Name: Zinc-SSO-Demo-SvenVanCaekenberghe.5
> Author: SvenVanCaekenberghe
> Time: 4 February 2013, 12:28:14.601 pm
> UUID: 4bb17785-f885-4db5-98f5-9c7d52d3add6
> Ancestors: Zinc-SSO-Demo-SvenVanCaekenberghe.4
>
> added ZnSSOServerDelegate>>#manipulateDemoFile:
> ---
>
> This should get you started.
>
> Note that it is not necessary to log in each time: the access token is valid until you get an unauthorized response.
> With the access token and the consumer data you can create service objects separate from the web app that did the setup.
>
> HTH,
>
> Sven
>
>
> >> Greetings
> >> Sabine
> >>
> >> On Wed, Jan 30, 2013 at 6:00 PM, Sabine Knöfel <[hidden email]> wrote:
> >> Hi Sven,
> >>
> >> there was only missing loading Zodiac, the dll (windows) was already included in the 1 klick image.
> >>
> >> Gofer it
> >>  squeaksource: 'Zodiac';
> >>  package: 'Zodiac-Core';
> >>  package: 'Zodiac-Tests';
> >>  load.
> >>
> >> It works. I play around now.
> >> Thank you very much!
> >> Sabine
> >>
> >>
> >> On Wed, Jan 30, 2013 at 5:38 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> >>
> >> On 30 Jan 2013, at 17:21, Sabine Knöfel <[hidden email]> wrote:
> >>
> >>> Hi Sven, hi Jan,
> >>>
> >>> thank you.
> >>> I am one step further now but there must be something else missing to load.
> >>> I failed with my current image, so I tried the following:
> >>>
> >>> I took a fresh image - the Pharo 1.4. one click app from the pharo homepage
> >>> (http://gforge.inria.fr/frs/download.php/31258/Pharo-1.4-14557-OneClick.zip)
> >>>
> >>> Then I loaded seaside 3.0 (from the welcome screen - MetacelloConfigurationBrowser open).
> >>>
> >>> After that, I loaded
> >>>
> >>> Gofer it
> >>>  url: 'http://mc.stfx.eu/ZincHTTPComponents';
> >>>  package: 'ConfigurationOfZincHTTPComponents';
> >>>  load.
> >>>
> >>> And then the bleeding Edge version
> >>> ConfigurationOfZincHTTPComponents project bleedingEdge load: 'SSO'.
> >>>
> >>> Then this was possible:
> >>> (ZnServer startDefaultOn: 8100)
> >>>        logToTranscript;
> >>>        debugMode: true;
> >>>        delegate: (ZnSSOServerDelegate new
> >>>                dropboxData: (ZnOAuth1ConsumerData newForDropbox
> >>>                                                                consumer: 'my appdata';
> >>>                                                                consumerSecret: 'my appdata';
> >>>                                                                yourself);
> >>>                yourself).
> >>>
> >>> No I tried in my browser
> >>> localhost:8100/sso-dropbox
> >>>
> >>> Then I got a walkback in my Image: No secure socket stream class set or available
> >>
> >> Well, the error says it all: you need TLS/SSL support. As is noted in
> >>
> >>  https://github.com/svenvc/docs/blob/master/zinc/zinc-sso-paper.md#installation
> >>
> >> You can get Zodiac to work in 1.4
> >>
> >>  http://zdc.stfx.eu
> >>
> >> Don't forget that you also need the plugin next to your VM !
> >>
> >> In Pharo 2.0 Zodiac is included by default the latest VM's there should have the plugin.
> >> But in 2.0 it will be slightly more difficult to load Seaside, but it does work.
> >>
> >> Sorry, but all this is still a bit in motion, hopefully you will keep trying.
> >>
> >>> ==>> I do not have the class ZdcSecureSocketStream in my Image
> >>> self secureSocketStreamClass is Nil in
> >>>
> >>> streamClassForScheme: scheme
> >>>    (#(http ws) includes: scheme) ifTrue: [
> >>>        ^ self socketStreamClass ].
> >>>    (#(https wss) includes: scheme) ifTrue: [
> >>>        ^ self secureSocketStreamClass ifNil: [
> >>>            self error: 'No secure socket stream class set or available' ] ].
> >>>    (ZnUnknownScheme scheme: scheme) signal
> >>>
> >>> Can you tell me what is missing to load?
> >>>
> >>> Greetings
> >>> Sabine
> >>>
> >>>
> >>> 30 January 2013 5:14:22.402 pm
> >>>
> >>> ZnNetworkingUtils(Object)>>error:
> >>>    Receiver: a ZnNetworkingUtils
> >>>    Arguments and temporary variables:
> >>>        aString:     'No secure socket stream class set or available'
> >>>    Receiver's instance variables:
> >>>        socketStreamClass:     SocketStream
> >>>        secureSocketStreamClass:     nil
> >>>
> >>> ZnNetworkingUtils>>streamClassForScheme:
> >>>    Receiver: a ZnNetworkingUtils
> >>>    Arguments and temporary variables:
> >>>        scheme:     #https
> >>>    Receiver's instance variables:
> >>>        socketStreamClass:     SocketStream
> >>>        secureSocketStreamClass:     nil
> >>>
> >>> ZnNetworkingUtils>>socketStreamToUrlDirectly:
> >>>    Receiver: a ZnNetworkingUtils
> >>>    Arguments and temporary variables:
> >>>        url:     https://api.dropbox.com/1/oauth/request_token
> >>>        stream:     nil
> >>>        address:     #[199 47 218 158]
> >>>    Receiver's instance variables:
> >>>        socketStreamClass:     SocketStream
> >>>        secureSocketStreamClass:     nil
> >>>
> >>> ZnNetworkingUtils>>socketStreamToUrl:
> >>>    Receiver: a ZnNetworkingUtils
> >>>    Arguments and temporary variables:
> >>>        url:     https://api.dropbox.com/1/oauth/request_token
> >>>    Receiver's instance variables:
> >>>        socketStreamClass:     SocketStream
> >>>        secureSocketStreamClass:     nil
> >>>
> >>>
> >>>
> >>>
> >>> On Wed, Jan 30, 2013 at 4:37 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> >>> Sabine,
> >>>
> >>> On 30 Jan 2013, at 16:24, Sabine Knöfel <[hidden email]> wrote:
> >>>
> >>>> Hi Sven,
> >>>>
> >>>> after loading:
> >>>>
> >>>> Gofer it
> >>>>  url: 'http://mc.stfx.eu/ZincHTTPComponents';
> >>>>  package: 'ConfigurationOfZincHTTPComponents';
> >>>>  load.
> >>>>
> >>>> ConfigurationOfZincHTTPComponents project latestVersion load: 'SSO'.
> >>>>
> >>>> The ZnOAuth1ConsumerData does not have a method called >>newForDropbox (but >>newForGoogle and >>newForTwitter).
> >>>> Also, ZnSSOServerDelegate does not have a method >>dropboxData: (but facebook, twittter and google)
> >>>>
> >>>> Did I miss something?
> >>>
> >>> Yes and no. The latest stable version of the configuration does not yet include the Dropbox code.
> >>> The following will load what is called bleedingEdge, the very latest version of everything, regardless of its release status.
> >>>
> >>>  ConfigurationOfZincHTTPComponents project bleedingEdge load: 'SSO'.
> >>>
> >>> Sorry about that.
> >>>
> >>> Sven
> >>>
> >>>> Greetings
> >>>> Sabine
> >>>>
> >>>>
> >>>> On Sun, Jan 27, 2013 at 8:47 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> >>>>
> >>>> On 27 Jan 2013, at 13:32, Sven Van Caekenberghe <[hidden email]> wrote:
> >>>>
> >>>>> If anyone is interested, I can write another email explaining how you can run this demo for yourself on your own account.
> >>>>
> >>>> How to run the Dropbox code yourself:
> >>>>
> >>>> 1. Get yourself a free Dropbox account at http://www.dropbox.com
> >>>>
> >>>> 2. Install some client software on one or more of your computers (Mac, Windows, Linux) or devices (iOS [iPhone, iPad, iPod], Android, BlackBerry, Kindle Fire) and move some files around to get a feel for the service.
> >>>>
> >>>> 3. When you give other applications access to (part of) your Dropbox files, you can check that at https://www.dropbox.com/account#applications
> >>>>
> >>>> 4. Define your own app that will try to access Dropbox files. Go to https://www.dropbox.com/developers (Developer home) and start defining a new app by clicking the 'Create an app' button at https://www.dropbox.com/developers/apps - start with the access type 'App folder'.
> >>>>
> >>>> 5. The two important elements you need are the 'App key' and 'App secret', make sure to copy them correctly.
> >>>>
> >>>> 6. Get the very latest code in your image (we develop in Pharo 2.0, but 1.4 or even 1.3 should work - SSL has to be fully operational).
> >>>>
> >>>> Gofer it
> >>>>  url: 'http://mc.stfx.eu/ZincHTTPComponents';
> >>>>  package: 'ConfigurationOfZincHTTPComponents';
> >>>>  load.
> >>>>
> >>>> ConfigurationOfZincHTTPComponents project latestVersion load: 'SSO'.
> >>>>
> >>>> 7. Start a Zn server with an appropriate delegate, configured for your app
> >>>>
> >>>> (ZnServer startDefaultOn: 8100)
> >>>>        logToTranscript;
> >>>>        debugMode: true;
> >>>>        delegate: (ZnSSOServerDelegate new
> >>>>                dropboxData: (ZnOAuth1ConsumerData newForDropbox
> >>>>                                                                consumer: 'vqz-app-key-zoca';
> >>>>                                                                consumerSecret: '13u-app-secret-8l006';
> >>>>                                                                yourself);
> >>>>                yourself).
> >>>>
> >>>> (The above is a demo setup limited to Dropbox, the other demos are not configured and won't work).
> >>>>
> >>>> 8. Go to http:://localhost:8100/sso-dropbox and click the link to log in - you will be transferred to Dropbox to log in (if you aren't already) and asked to authorise your demo app, after which Dropbox will redirect you back to your app.
> >>>>
> >>>> 9. Once back in your app, sso-dropbox-callback (#ssoDropboxCallback:) will access your account info and list the app root folder, which will then be shown.
> >>>>
> >>>> 10. For the rest of the API, (currently not yet implemented), see https://www.dropbox.com/developers/reference/api - you don't have to worry about the whole authentication thanks to Zinc-SSO.
> >>>>
> >>>> We would love for others to try this (as well as the other Zinc-SSO options, Google, Facebook, Twitter) out, in their own projects, and to provide actual feedback and generally help improve the code and documentation.
> >>>>
> >>>> As always, May the Source be with you!
> >>>>
> >>>> Sven
> >>>>
> >>>> PS: The demo app is not (yet) a production app: only you and up to 5 explicitly listed users can use it. You have to apply for production status later on. Also, the whole ZnSSOServerDelegate code is a demo, for an actual project, it would be best to extract the necessary parts out of it, reusing the underlying Zinc-SSO-OAuth1-Core framework.
> >>>>
> >>>> --
> >>>> Sven Van Caekenberghe
> >>>> http://stfx.eu
> >>>> Smalltalk is the Red Pill
> >>>>
> >>>>
>



Reply | Threaded
Open this post in threaded view
|

Re: [Update] Zinc-SSO now supports Dropbox !

Sven Van Caekenberghe-2

On 07 Feb 2013, at 12:04, Sabine Knöfel <[hidden email]> wrote:

> Hi Sven,
>
> I created the ZnOAuth1DropboxUserAccess with the ZnOAuth1Service and ZnOAuth1ConsumerData instances in it. Then I assigned the accessToken from an inspector.
>
> That worked. I was able to read the file from the dropbox with getFile:. Great!
>
> I used that code (please note "STON fromString: in contents asString ")
>
> save the ZnOAuth1DropboxUserAccess as file:
> (Path * 'plonk.txt') asFileReference
>     fileStreamDo: [ :stream |
>         STON put: self onStreamPretty: stream ].
>
> Read and create the ZnOAuth1DropboxUserAccess  instance and then get contents of the demo file
> ((Path * 'plonk.ston') asFileReference
>         readStreamDo: [ :in | STON fromString: in contents asString    ]) getFile: #( 'demo.txt' ).
>
> This is fine.
> My next question is how can I create an instance of ZnOAuth1Token from WITHIN my application?
>
> When I need this ZnOAuth1Token, I am in a subclass of WAComponent.
> I don't want the user to click at a link like localhost:8100/sso-dropbox.

Sure, look at the implementation of #ssoDropbox:
You already know how to create the service object (#dropboxOAuth1Service),
next you need a request token (#getRequestToken).
Both of these steps don't require user interaction.

The URL you are looking for is constructed as follows:

oauthService loginUrlFor: requestToken callbackUrl: request server url / 'sso-dropbox-callback'

The callback URL has to point to your Seaside app somewhere.

The difference you are looking for is also visible (for other providers) in the difference between #ssoDemo: and #ssoGoogle: for example (that is, the direct link vs the embedded link).

Note that the Zinc-SSO project has a complete Seaside demo as well (Jan wrote that one, it just doesn't include the Dropbox code (yet, hint, hint)), if you know Seaside it will certainly help to look at that code.

You'll have to do this login (ask for Dropbox access) only once, store the tokens that come back and from then on, you should be able to keep using the user access object (if you store it somewhere).

Let me know how it goes.

Sven

> Clicking at a button within my application should send the user directly to the dropbox page to grant access and create the ZnOAuth1Token.
>
> Cold you perhaps create a small code example like this
>
> renderContentOn: method
>
>     html anchor
>         script: html jQuery this button;
>         url: '???http://localhost:8100/sso-dropbox???';
>         with: 'send me to dropbox, create ZnOAuth1Token and return it in some way'.  
>
> Greetings
> Sabine
>
>
>
>
> On Tue, Feb 5, 2013 at 5:22 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> Sabine,
>
> On 05 Feb 2013, at 14:45, Sabine Knöfel <[hidden email]> wrote:
>
> > Hi Sven,
> >
> > great! The file was created in my dropbox account:-)
>
> And it will be read, updated and written from now on, every time you run the demo.
>
> > I will try to use it now in my application and will come back with questions if they occur.
>
> Yesterday I used STON to serialize a ZnOAuth1DropboxUserAccess instance that was created from the demo web app demo.
>
> To make such an instance you use the codes that were also needed to set up the web demo and the 2 part access token that the web app requested and was granted by the user. To access this token, you currently have to inspect/explore the sessions in the ZnServer instance (there will normally only be one) and assign it to the following object (this is all in hack/debug mode):
>
> | data service |
>
> data := ZnOAuth1ConsumerData newForDropbox
>         consumer: 'vqzexpgl5rvzXXX';
>         consumerSecret: '13uygcdbou8lXXX';
>         yourself.
>
> service := ZnOAuth1Service new
>         providerAccount: data ;
>         yourself.
>
> ZnOAuth1DropboxUserAccess new
>         oauth1Service: service;
>         yourself.
>
> (And send it #accessToken:).
>
> This will give you a representation like this:
>
> ZnOAuth1DropboxUserAccess {
>         #oauth1Service : ZnOAuth1Service {
>                 #providerAccount : ZnOAuth1ConsumerData {
>                         #getRequestTokenUrl : 'https://api.dropbox.com/1/oauth/request_token',
>                         #authorizeTokenUrl : 'https://www.dropbox.com/1/oauth/authorize',
>                         #getAccessTokenUrl : 'https://api.dropbox.com/1/oauth/access_token',
>                         #consumer : 'vqzexpgl5rvzXXX',
>                         #consumerSecret : '13uygcdbou8lXXX',
>                         #accessTokenClass : nil
>                 }
>         },
>         #accessToken : ZnOAuth1Token {
>                 #value : 'qdcm6mivqesdXXX',
>                 #secret : '39w7r9wqamdgXXX',
>                 #sessionid : nil
>         }
> }
>
> I don't know what the lifetime is of this, but from other apps using Dropbox I am guessing it must be pretty long, even close to infinite.
> So one day later, with the demo web app long gone and image restarted, I can do this:
>
> ('ZnOAuth1DropboxUserAccess.ston' asFileReference
>         readStreamDo: [ :in | STON fromString: in ]) getFile: #( 'demo.txt' ).
>
> And it just works.
>
> Now, we have to work out a way to make this flow easier and secure at the same time.
>
> > Thank you very much.
>
> We wrote this so that others can use it, so we are happy with other developers trying out our stuff.
>
> Thanks for testing and for the feedback.
>
> Sven
>
> > Sabine
> >
> > On Mon, Feb 4, 2013 at 12:52 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> >
> > On 30 Jan 2013, at 19:13, Sven Van Caekenberghe <[hidden email]> wrote:
> >
> > > On 30 Jan 2013, at 18:32, Sabine Knöfel <[hidden email]> wrote:
> > >
> > >> Sven,
> > >>
> > >> could you provide a simple code fragment which shows how to write and how to read a file from the smalltalk image to the connected dropbox app folder?
> > >
> > > The whole API is not (yet) implemented.
> > >
> > >  https://www.dropbox.com/developers/reference/api
> > >
> > > Have a look at ZnOAuth1TwitterUserAccess.
> > >
> > > If I find more time, I might try myself.
> > >
> > > GET is pretty straightforward, for PUT or POST you will have to supply a ZnEntity of a specific mime-type with bytes or a string.
> > >
> > > Note that for file access the host is different.
> >
> > I added a bit more Dropbox API and a little demo accessing files.
> >
> > There is now #manipulateDemoFile: which will try to access a file called 'demo.txt' and read an id out of it. If found the file is written again, with the id increased and some other fields updated as well. If the file did not exist, it is created with id 1. All this happens automatically if you access /sso-dropbox and log in. You'll get the updated id in the web page and you'll see your Dropbox client doing a local update immediately!
> >
> > Here are the details (http://mc.stfx.eu/Zinc-HTTP-Components):
> >
> > ---
> > Name: Zinc-SSO-OAuth1-Core-SvenVanCaekenberghe.13
> > Author: SvenVanCaekenberghe
> > Time: 4 February 2013, 12:27:12.196 pm
> > UUID: 3d78a965-462e-4a4e-94aa-1779369aecb8
> > Ancestors: Zinc-SSO-OAuth1-Core-SvenVanCaekenberghe.12
> >
> > extended ZnOAuth1Service with #httpDelete:using: #httpPost:with:using: #httpPut:with:using:
> > extended ZnOAuth1DropboxUserAccess with #getFile: and #putFile:data:
> > some refactoring in ZnOAuth1DropboxUserAccess
> > ---
> > Name: Zinc-SSO-Demo-SvenVanCaekenberghe.5
> > Author: SvenVanCaekenberghe
> > Time: 4 February 2013, 12:28:14.601 pm
> > UUID: 4bb17785-f885-4db5-98f5-9c7d52d3add6
> > Ancestors: Zinc-SSO-Demo-SvenVanCaekenberghe.4
> >
> > added ZnSSOServerDelegate>>#manipulateDemoFile:
> > ---
> >
> > This should get you started.
> >
> > Note that it is not necessary to log in each time: the access token is valid until you get an unauthorized response.
> > With the access token and the consumer data you can create service objects separate from the web app that did the setup.
> >
> > HTH,
> >
> > Sven
> >
> >
> > >> Greetings
> > >> Sabine
> > >>
> > >> On Wed, Jan 30, 2013 at 6:00 PM, Sabine Knöfel <[hidden email]> wrote:
> > >> Hi Sven,
> > >>
> > >> there was only missing loading Zodiac, the dll (windows) was already included in the 1 klick image.
> > >>
> > >> Gofer it
> > >>  squeaksource: 'Zodiac';
> > >>  package: 'Zodiac-Core';
> > >>  package: 'Zodiac-Tests';
> > >>  load.
> > >>
> > >> It works. I play around now.
> > >> Thank you very much!
> > >> Sabine
> > >>
> > >>
> > >> On Wed, Jan 30, 2013 at 5:38 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> > >>
> > >> On 30 Jan 2013, at 17:21, Sabine Knöfel <[hidden email]> wrote:
> > >>
> > >>> Hi Sven, hi Jan,
> > >>>
> > >>> thank you.
> > >>> I am one step further now but there must be something else missing to load.
> > >>> I failed with my current image, so I tried the following:
> > >>>
> > >>> I took a fresh image - the Pharo 1.4. one click app from the pharo homepage
> > >>> (http://gforge.inria.fr/frs/download.php/31258/Pharo-1.4-14557-OneClick.zip)
> > >>>
> > >>> Then I loaded seaside 3.0 (from the welcome screen - MetacelloConfigurationBrowser open).
> > >>>
> > >>> After that, I loaded
> > >>>
> > >>> Gofer it
> > >>>  url: 'http://mc.stfx.eu/ZincHTTPComponents';
> > >>>  package: 'ConfigurationOfZincHTTPComponents';
> > >>>  load.
> > >>>
> > >>> And then the bleeding Edge version
> > >>> ConfigurationOfZincHTTPComponents project bleedingEdge load: 'SSO'.
> > >>>
> > >>> Then this was possible:
> > >>> (ZnServer startDefaultOn: 8100)
> > >>>        logToTranscript;
> > >>>        debugMode: true;
> > >>>        delegate: (ZnSSOServerDelegate new
> > >>>                dropboxData: (ZnOAuth1ConsumerData newForDropbox
> > >>>                                                                consumer: 'my appdata';
> > >>>                                                                consumerSecret: 'my appdata';
> > >>>                                                                yourself);
> > >>>                yourself).
> > >>>
> > >>> No I tried in my browser
> > >>> localhost:8100/sso-dropbox
> > >>>
> > >>> Then I got a walkback in my Image: No secure socket stream class set or available
> > >>
> > >> Well, the error says it all: you need TLS/SSL support. As is noted in
> > >>
> > >>  https://github.com/svenvc/docs/blob/master/zinc/zinc-sso-paper.md#installation
> > >>
> > >> You can get Zodiac to work in 1.4
> > >>
> > >>  http://zdc.stfx.eu
> > >>
> > >> Don't forget that you also need the plugin next to your VM !
> > >>
> > >> In Pharo 2.0 Zodiac is included by default the latest VM's there should have the plugin.
> > >> But in 2.0 it will be slightly more difficult to load Seaside, but it does work.
> > >>
> > >> Sorry, but all this is still a bit in motion, hopefully you will keep trying.
> > >>
> > >>> ==>> I do not have the class ZdcSecureSocketStream in my Image
> > >>> self secureSocketStreamClass is Nil in
> > >>>
> > >>> streamClassForScheme: scheme
> > >>>    (#(http ws) includes: scheme) ifTrue: [
> > >>>        ^ self socketStreamClass ].
> > >>>    (#(https wss) includes: scheme) ifTrue: [
> > >>>        ^ self secureSocketStreamClass ifNil: [
> > >>>            self error: 'No secure socket stream class set or available' ] ].
> > >>>    (ZnUnknownScheme scheme: scheme) signal
> > >>>
> > >>> Can you tell me what is missing to load?
> > >>>
> > >>> Greetings
> > >>> Sabine
> > >>>
> > >>>
> > >>> 30 January 2013 5:14:22.402 pm
> > >>>
> > >>> ZnNetworkingUtils(Object)>>error:
> > >>>    Receiver: a ZnNetworkingUtils
> > >>>    Arguments and temporary variables:
> > >>>        aString:     'No secure socket stream class set or available'
> > >>>    Receiver's instance variables:
> > >>>        socketStreamClass:     SocketStream
> > >>>        secureSocketStreamClass:     nil
> > >>>
> > >>> ZnNetworkingUtils>>streamClassForScheme:
> > >>>    Receiver: a ZnNetworkingUtils
> > >>>    Arguments and temporary variables:
> > >>>        scheme:     #https
> > >>>    Receiver's instance variables:
> > >>>        socketStreamClass:     SocketStream
> > >>>        secureSocketStreamClass:     nil
> > >>>
> > >>> ZnNetworkingUtils>>socketStreamToUrlDirectly:
> > >>>    Receiver: a ZnNetworkingUtils
> > >>>    Arguments and temporary variables:
> > >>>        url:     https://api.dropbox.com/1/oauth/request_token
> > >>>        stream:     nil
> > >>>        address:     #[199 47 218 158]
> > >>>    Receiver's instance variables:
> > >>>        socketStreamClass:     SocketStream
> > >>>        secureSocketStreamClass:     nil
> > >>>
> > >>> ZnNetworkingUtils>>socketStreamToUrl:
> > >>>    Receiver: a ZnNetworkingUtils
> > >>>    Arguments and temporary variables:
> > >>>        url:     https://api.dropbox.com/1/oauth/request_token
> > >>>    Receiver's instance variables:
> > >>>        socketStreamClass:     SocketStream
> > >>>        secureSocketStreamClass:     nil
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> On Wed, Jan 30, 2013 at 4:37 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> > >>> Sabine,
> > >>>
> > >>> On 30 Jan 2013, at 16:24, Sabine Knöfel <[hidden email]> wrote:
> > >>>
> > >>>> Hi Sven,
> > >>>>
> > >>>> after loading:
> > >>>>
> > >>>> Gofer it
> > >>>>  url: 'http://mc.stfx.eu/ZincHTTPComponents';
> > >>>>  package: 'ConfigurationOfZincHTTPComponents';
> > >>>>  load.
> > >>>>
> > >>>> ConfigurationOfZincHTTPComponents project latestVersion load: 'SSO'.
> > >>>>
> > >>>> The ZnOAuth1ConsumerData does not have a method called >>newForDropbox (but >>newForGoogle and >>newForTwitter).
> > >>>> Also, ZnSSOServerDelegate does not have a method >>dropboxData: (but facebook, twittter and google)
> > >>>>
> > >>>> Did I miss something?
> > >>>
> > >>> Yes and no. The latest stable version of the configuration does not yet include the Dropbox code.
> > >>> The following will load what is called bleedingEdge, the very latest version of everything, regardless of its release status.
> > >>>
> > >>>  ConfigurationOfZincHTTPComponents project bleedingEdge load: 'SSO'.
> > >>>
> > >>> Sorry about that.
> > >>>
> > >>> Sven
> > >>>
> > >>>> Greetings
> > >>>> Sabine
> > >>>>
> > >>>>
> > >>>> On Sun, Jan 27, 2013 at 8:47 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> > >>>>
> > >>>> On 27 Jan 2013, at 13:32, Sven Van Caekenberghe <[hidden email]> wrote:
> > >>>>
> > >>>>> If anyone is interested, I can write another email explaining how you can run this demo for yourself on your own account.
> > >>>>
> > >>>> How to run the Dropbox code yourself:
> > >>>>
> > >>>> 1. Get yourself a free Dropbox account at http://www.dropbox.com
> > >>>>
> > >>>> 2. Install some client software on one or more of your computers (Mac, Windows, Linux) or devices (iOS [iPhone, iPad, iPod], Android, BlackBerry, Kindle Fire) and move some files around to get a feel for the service.
> > >>>>
> > >>>> 3. When you give other applications access to (part of) your Dropbox files, you can check that at https://www.dropbox.com/account#applications
> > >>>>
> > >>>> 4. Define your own app that will try to access Dropbox files. Go to https://www.dropbox.com/developers (Developer home) and start defining a new app by clicking the 'Create an app' button at https://www.dropbox.com/developers/apps - start with the access type 'App folder'.
> > >>>>
> > >>>> 5. The two important elements you need are the 'App key' and 'App secret', make sure to copy them correctly.
> > >>>>
> > >>>> 6. Get the very latest code in your image (we develop in Pharo 2.0, but 1.4 or even 1.3 should work - SSL has to be fully operational).
> > >>>>
> > >>>> Gofer it
> > >>>>  url: 'http://mc.stfx.eu/ZincHTTPComponents';
> > >>>>  package: 'ConfigurationOfZincHTTPComponents';
> > >>>>  load.
> > >>>>
> > >>>> ConfigurationOfZincHTTPComponents project latestVersion load: 'SSO'.
> > >>>>
> > >>>> 7. Start a Zn server with an appropriate delegate, configured for your app
> > >>>>
> > >>>> (ZnServer startDefaultOn: 8100)
> > >>>>        logToTranscript;
> > >>>>        debugMode: true;
> > >>>>        delegate: (ZnSSOServerDelegate new
> > >>>>                dropboxData: (ZnOAuth1ConsumerData newForDropbox
> > >>>>                                                                consumer: 'vqz-app-key-zoca';
> > >>>>                                                                consumerSecret: '13u-app-secret-8l006';
> > >>>>                                                                yourself);
> > >>>>                yourself).
> > >>>>
> > >>>> (The above is a demo setup limited to Dropbox, the other demos are not configured and won't work).
> > >>>>
> > >>>> 8. Go to http:://localhost:8100/sso-dropbox and click the link to log in - you will be transferred to Dropbox to log in (if you aren't already) and asked to authorise your demo app, after which Dropbox will redirect you back to your app.
> > >>>>
> > >>>> 9. Once back in your app, sso-dropbox-callback (#ssoDropboxCallback:) will access your account info and list the app root folder, which will then be shown.
> > >>>>
> > >>>> 10. For the rest of the API, (currently not yet implemented), see https://www.dropbox.com/developers/reference/api - you don't have to worry about the whole authentication thanks to Zinc-SSO.
> > >>>>
> > >>>> We would love for others to try this (as well as the other Zinc-SSO options, Google, Facebook, Twitter) out, in their own projects, and to provide actual feedback and generally help improve the code and documentation.
> > >>>>
> > >>>> As always, May the Source be with you!
> > >>>>
> > >>>> Sven
> > >>>>
> > >>>> PS: The demo app is not (yet) a production app: only you and up to 5 explicitly listed users can use it. You have to apply for production status later on. Also, the whole ZnSSOServerDelegate code is a demo, for an actual project, it would be best to extract the necessary parts out of it, reusing the underlying Zinc-SSO-OAuth1-Core framework.
> > >>>>
> > >>>> --
> > >>>> Sven Van Caekenberghe
> > >>>> http://stfx.eu
> > >>>> Smalltalk is the Red Pill
> > >>>>
> > >>>>
> >
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: [Update] Zinc-SSO now supports Dropbox !

Sabine Manaa
Hi Sven,

sorry, I think there is something basic, that I miss.

In my >>renderContentOn: , I call >>renderDropboxHeadingOn:

renderDropboxHeadingOn: html
    | theOauthService theRequestToken theUrl theUserAssess theConsumerData |
      theConsumerData := ZnOAuth1ConsumerData newForDropbox
        consumer: 'ql5uuynlvybiqp3';
        consumerSecret: 'hwjrqa8qnxwxxxx';
        yourself.
    theOauthService := ZnOAuth1Service new
        providerAccount: theConsumerData;
        yourself.       
    theRequestToken := theOauthService getRequestToken.
    theUserAssess := ZnOAuth1DropboxUserAccess new
        oauth1Service: theOauthService;
        accessToken: theRequestToken. 
    "===>>> self dropboxSessionFor: request put: requestToken."
    theUrl := (theOauthService loginUrlFor: theRequestToken callbackUrl: 'http://localhost:8100/sso-dropbox-callback')
        asString.
    html anchor
        script: html jQuery this button;
        onClick: (html prototype evaluator callback: [ :script |   ]);
        url: theUrl;
        with: 'Save data in dropbox'

Click on this button leads me to the dropbox-grant-access page -> ok, thats what I wanted.

In the demo code, >>ssoDropbox:,  the requestToken is assigned to the ZnServerSession instance:
self dropboxSessionFor: request  put: requestToken.

Because I do not have the ZnServerSession instance within my subclass of WAApplication, I did not assign it.
This leads to "Not a valid callback request" error, because in >>ssoDropboxData:, the accessToken can not be found.
This is clear, because I did not assign it ;-)

The question is how to solve this in the right way.

Where can I find the code/package of the seaside demo app from Jan?
I found this: http://forum.world.st/Update-Zinc-SSO-OAuth-2-0-Alpha-Code-amp-Live-Demos-td4660771.html#a4660911
but http://sso.doit.st did not work.

Thank you for your help.
Sabine




       
       
        


On Thu, Feb 7, 2013 at 1:04 PM, Sven Van Caekenberghe <[hidden email]> wrote:

On 07 Feb 2013, at 12:04, Sabine Knöfel <[hidden email]> wrote:

> Hi Sven,
>
> I created the ZnOAuth1DropboxUserAccess with the ZnOAuth1Service and ZnOAuth1ConsumerData instances in it. Then I assigned the accessToken from an inspector.
>
> That worked. I was able to read the file from the dropbox with getFile:. Great!
>
> I used that code (please note "STON fromString: in contents asString ")
>
> save the ZnOAuth1DropboxUserAccess as file:
> (Path * 'plonk.txt') asFileReference
>     fileStreamDo: [ :stream |
>         STON put: self onStreamPretty: stream ].
>
> Read and create the ZnOAuth1DropboxUserAccess  instance and then get contents of the demo file
> ((Path * 'plonk.ston') asFileReference
>         readStreamDo: [ :in | STON fromString: in contents asString    ]) getFile: #( 'demo.txt' ).
>
> This is fine.
> My next question is how can I create an instance of ZnOAuth1Token from WITHIN my application?
>
> When I need this ZnOAuth1Token, I am in a subclass of WAComponent.
> I don't want the user to click at a link like localhost:8100/sso-dropbox.

Sure, look at the implementation of #ssoDropbox:
You already know how to create the service object (#dropboxOAuth1Service),
next you need a request token (#getRequestToken).
Both of these steps don't require user interaction.

The URL you are looking for is constructed as follows:

oauthService loginUrlFor: requestToken callbackUrl: request server url / 'sso-dropbox-callback'

The callback URL has to point to your Seaside app somewhere.

The difference you are looking for is also visible (for other providers) in the difference between #ssoDemo: and #ssoGoogle: for example (that is, the direct link vs the embedded link).

Note that the Zinc-SSO project has a complete Seaside demo as well (Jan wrote that one, it just doesn't include the Dropbox code (yet, hint, hint)), if you know Seaside it will certainly help to look at that code.

You'll have to do this login (ask for Dropbox access) only once, store the tokens that come back and from then on, you should be able to keep using the user access object (if you store it somewhere).

Let me know how it goes.

Sven

> Clicking at a button within my application should send the user directly to the dropbox page to grant access and create the ZnOAuth1Token.
>
> Cold you perhaps create a small code example like this
>
> renderContentOn: method
>
>     html anchor
>         script: html jQuery this button;
>         url: '???http://localhost:8100/sso-dropbox???';
>         with: 'send me to dropbox, create ZnOAuth1Token and return it in some way'.
>
> Greetings
> Sabine
>
>
>
>
> On Tue, Feb 5, 2013 at 5:22 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> Sabine,
>
> On 05 Feb 2013, at 14:45, Sabine Knöfel <[hidden email]> wrote:
>
> > Hi Sven,
> >
> > great! The file was created in my dropbox account:-)
>
> And it will be read, updated and written from now on, every time you run the demo.
>
> > I will try to use it now in my application and will come back with questions if they occur.
>
> Yesterday I used STON to serialize a ZnOAuth1DropboxUserAccess instance that was created from the demo web app demo.
>
> To make such an instance you use the codes that were also needed to set up the web demo and the 2 part access token that the web app requested and was granted by the user. To access this token, you currently have to inspect/explore the sessions in the ZnServer instance (there will normally only be one) and assign it to the following object (this is all in hack/debug mode):
>
> | data service |
>
> data := ZnOAuth1ConsumerData newForDropbox
>         consumer: 'vqzexpgl5rvzXXX';
>         consumerSecret: '13uygcdbou8lXXX';
>         yourself.
>
> service := ZnOAuth1Service new
>         providerAccount: data ;
>         yourself.
>
> ZnOAuth1DropboxUserAccess new
>         oauth1Service: service;
>         yourself.
>
> (And send it #accessToken:).
>
> This will give you a representation like this:
>
> ZnOAuth1DropboxUserAccess {
>         #oauth1Service : ZnOAuth1Service {
>                 #providerAccount : ZnOAuth1ConsumerData {
>                         #getRequestTokenUrl : 'https://api.dropbox.com/1/oauth/request_token',
>                         #authorizeTokenUrl : 'https://www.dropbox.com/1/oauth/authorize',
>                         #getAccessTokenUrl : 'https://api.dropbox.com/1/oauth/access_token',
>                         #consumer : 'vqzexpgl5rvzXXX',
>                         #consumerSecret : '13uygcdbou8lXXX',
>                         #accessTokenClass : nil
>                 }
>         },
>         #accessToken : ZnOAuth1Token {
>                 #value : 'qdcm6mivqesdXXX',
>                 #secret : '39w7r9wqamdgXXX',
>                 #sessionid : nil
>         }
> }
>
> I don't know what the lifetime is of this, but from other apps using Dropbox I am guessing it must be pretty long, even close to infinite.
> So one day later, with the demo web app long gone and image restarted, I can do this:
>
> ('ZnOAuth1DropboxUserAccess.ston' asFileReference
>         readStreamDo: [ :in | STON fromString: in ]) getFile: #( 'demo.txt' ).
>
> And it just works.
>
> Now, we have to work out a way to make this flow easier and secure at the same time.
>
> > Thank you very much.
>
> We wrote this so that others can use it, so we are happy with other developers trying out our stuff.
>
> Thanks for testing and for the feedback.
>
> Sven
>
> > Sabine
> >
> > On Mon, Feb 4, 2013 at 12:52 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> >
> > On 30 Jan 2013, at 19:13, Sven Van Caekenberghe <[hidden email]> wrote:
> >
> > > On 30 Jan 2013, at 18:32, Sabine Knöfel <[hidden email]> wrote:
> > >
> > >> Sven,
> > >>
> > >> could you provide a simple code fragment which shows how to write and how to read a file from the smalltalk image to the connected dropbox app folder?
> > >
> > > The whole API is not (yet) implemented.
> > >
> > >  https://www.dropbox.com/developers/reference/api
> > >
> > > Have a look at ZnOAuth1TwitterUserAccess.
> > >
> > > If I find more time, I might try myself.
> > >
> > > GET is pretty straightforward, for PUT or POST you will have to supply a ZnEntity of a specific mime-type with bytes or a string.
> > >
> > > Note that for file access the host is different.
> >
> > I added a bit more Dropbox API and a little demo accessing files.
> >
> > There is now #manipulateDemoFile: which will try to access a file called 'demo.txt' and read an id out of it. If found the file is written again, with the id increased and some other fields updated as well. If the file did not exist, it is created with id 1. All this happens automatically if you access /sso-dropbox and log in. You'll get the updated id in the web page and you'll see your Dropbox client doing a local update immediately!
> >
> > Here are the details (http://mc.stfx.eu/Zinc-HTTP-Components):
> >
> > ---
> > Name: Zinc-SSO-OAuth1-Core-SvenVanCaekenberghe.13
> > Author: SvenVanCaekenberghe
> > Time: 4 February 2013, 12:27:12.196 pm
> > UUID: 3d78a965-462e-4a4e-94aa-1779369aecb8
> > Ancestors: Zinc-SSO-OAuth1-Core-SvenVanCaekenberghe.12
> >
> > extended ZnOAuth1Service with #httpDelete:using: #httpPost:with:using: #httpPut:with:using:
> > extended ZnOAuth1DropboxUserAccess with #getFile: and #putFile:data:
> > some refactoring in ZnOAuth1DropboxUserAccess
> > ---
> > Name: Zinc-SSO-Demo-SvenVanCaekenberghe.5
> > Author: SvenVanCaekenberghe
> > Time: 4 February 2013, 12:28:14.601 pm
> > UUID: 4bb17785-f885-4db5-98f5-9c7d52d3add6
> > Ancestors: Zinc-SSO-Demo-SvenVanCaekenberghe.4
> >
> > added ZnSSOServerDelegate>>#manipulateDemoFile:
> > ---
> >
> > This should get you started.
> >
> > Note that it is not necessary to log in each time: the access token is valid until you get an unauthorized response.
> > With the access token and the consumer data you can create service objects separate from the web app that did the setup.
> >
> > HTH,
> >
> > Sven
> >
> >
> > >> Greetings
> > >> Sabine
> > >>
> > >> On Wed, Jan 30, 2013 at 6:00 PM, Sabine Knöfel <[hidden email]> wrote:
> > >> Hi Sven,
> > >>
> > >> there was only missing loading Zodiac, the dll (windows) was already included in the 1 klick image.
> > >>
> > >> Gofer it
> > >>  squeaksource: 'Zodiac';
> > >>  package: 'Zodiac-Core';
> > >>  package: 'Zodiac-Tests';
> > >>  load.
> > >>
> > >> It works. I play around now.
> > >> Thank you very much!
> > >> Sabine
> > >>
> > >>
> > >> On Wed, Jan 30, 2013 at 5:38 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> > >>
> > >> On 30 Jan 2013, at 17:21, Sabine Knöfel <[hidden email]> wrote:
> > >>
> > >>> Hi Sven, hi Jan,
> > >>>
> > >>> thank you.
> > >>> I am one step further now but there must be something else missing to load.
> > >>> I failed with my current image, so I tried the following:
> > >>>
> > >>> I took a fresh image - the Pharo 1.4. one click app from the pharo homepage
> > >>> (http://gforge.inria.fr/frs/download.php/31258/Pharo-1.4-14557-OneClick.zip)
> > >>>
> > >>> Then I loaded seaside 3.0 (from the welcome screen - MetacelloConfigurationBrowser open).
> > >>>
> > >>> After that, I loaded
> > >>>
> > >>> Gofer it
> > >>>  url: 'http://mc.stfx.eu/ZincHTTPComponents';
> > >>>  package: 'ConfigurationOfZincHTTPComponents';
> > >>>  load.
> > >>>
> > >>> And then the bleeding Edge version
> > >>> ConfigurationOfZincHTTPComponents project bleedingEdge load: 'SSO'.
> > >>>
> > >>> Then this was possible:
> > >>> (ZnServer startDefaultOn: 8100)
> > >>>        logToTranscript;
> > >>>        debugMode: true;
> > >>>        delegate: (ZnSSOServerDelegate new
> > >>>                dropboxData: (ZnOAuth1ConsumerData newForDropbox
> > >>>                                                                consumer: 'my appdata';
> > >>>                                                                consumerSecret: 'my appdata';
> > >>>                                                                yourself);
> > >>>                yourself).
> > >>>
> > >>> No I tried in my browser
> > >>> localhost:8100/sso-dropbox
> > >>>
> > >>> Then I got a walkback in my Image: No secure socket stream class set or available
> > >>
> > >> Well, the error says it all: you need TLS/SSL support. As is noted in
> > >>
> > >>  https://github.com/svenvc/docs/blob/master/zinc/zinc-sso-paper.md#installation
> > >>
> > >> You can get Zodiac to work in 1.4
> > >>
> > >>  http://zdc.stfx.eu
> > >>
> > >> Don't forget that you also need the plugin next to your VM !
> > >>
> > >> In Pharo 2.0 Zodiac is included by default the latest VM's there should have the plugin.
> > >> But in 2.0 it will be slightly more difficult to load Seaside, but it does work.
> > >>
> > >> Sorry, but all this is still a bit in motion, hopefully you will keep trying.
> > >>
> > >>> ==>> I do not have the class ZdcSecureSocketStream in my Image
> > >>> self secureSocketStreamClass is Nil in
> > >>>
> > >>> streamClassForScheme: scheme
> > >>>    (#(http ws) includes: scheme) ifTrue: [
> > >>>        ^ self socketStreamClass ].
> > >>>    (#(https wss) includes: scheme) ifTrue: [
> > >>>        ^ self secureSocketStreamClass ifNil: [
> > >>>            self error: 'No secure socket stream class set or available' ] ].
> > >>>    (ZnUnknownScheme scheme: scheme) signal
> > >>>
> > >>> Can you tell me what is missing to load?
> > >>>
> > >>> Greetings
> > >>> Sabine
> > >>>
> > >>>
> > >>> 30 January 2013 5:14:22.402 pm
> > >>>
> > >>> ZnNetworkingUtils(Object)>>error:
> > >>>    Receiver: a ZnNetworkingUtils
> > >>>    Arguments and temporary variables:
> > >>>        aString:     'No secure socket stream class set or available'
> > >>>    Receiver's instance variables:
> > >>>        socketStreamClass:     SocketStream
> > >>>        secureSocketStreamClass:     nil
> > >>>
> > >>> ZnNetworkingUtils>>streamClassForScheme:
> > >>>    Receiver: a ZnNetworkingUtils
> > >>>    Arguments and temporary variables:
> > >>>        scheme:     #https
> > >>>    Receiver's instance variables:
> > >>>        socketStreamClass:     SocketStream
> > >>>        secureSocketStreamClass:     nil
> > >>>
> > >>> ZnNetworkingUtils>>socketStreamToUrlDirectly:
> > >>>    Receiver: a ZnNetworkingUtils
> > >>>    Arguments and temporary variables:
> > >>>        url:     https://api.dropbox.com/1/oauth/request_token
> > >>>        stream:     nil
> > >>>        address:     #[199 47 218 158]
> > >>>    Receiver's instance variables:
> > >>>        socketStreamClass:     SocketStream
> > >>>        secureSocketStreamClass:     nil
> > >>>
> > >>> ZnNetworkingUtils>>socketStreamToUrl:
> > >>>    Receiver: a ZnNetworkingUtils
> > >>>    Arguments and temporary variables:
> > >>>        url:     https://api.dropbox.com/1/oauth/request_token
> > >>>    Receiver's instance variables:
> > >>>        socketStreamClass:     SocketStream
> > >>>        secureSocketStreamClass:     nil
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> On Wed, Jan 30, 2013 at 4:37 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> > >>> Sabine,
> > >>>
> > >>> On 30 Jan 2013, at 16:24, Sabine Knöfel <[hidden email]> wrote:
> > >>>
> > >>>> Hi Sven,
> > >>>>
> > >>>> after loading:
> > >>>>
> > >>>> Gofer it
> > >>>>  url: 'http://mc.stfx.eu/ZincHTTPComponents';
> > >>>>  package: 'ConfigurationOfZincHTTPComponents';
> > >>>>  load.
> > >>>>
> > >>>> ConfigurationOfZincHTTPComponents project latestVersion load: 'SSO'.
> > >>>>
> > >>>> The ZnOAuth1ConsumerData does not have a method called >>newForDropbox (but >>newForGoogle and >>newForTwitter).
> > >>>> Also, ZnSSOServerDelegate does not have a method >>dropboxData: (but facebook, twittter and google)
> > >>>>
> > >>>> Did I miss something?
> > >>>
> > >>> Yes and no. The latest stable version of the configuration does not yet include the Dropbox code.
> > >>> The following will load what is called bleedingEdge, the very latest version of everything, regardless of its release status.
> > >>>
> > >>>  ConfigurationOfZincHTTPComponents project bleedingEdge load: 'SSO'.
> > >>>
> > >>> Sorry about that.
> > >>>
> > >>> Sven
> > >>>
> > >>>> Greetings
> > >>>> Sabine
> > >>>>
> > >>>>
> > >>>> On Sun, Jan 27, 2013 at 8:47 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> > >>>>
> > >>>> On 27 Jan 2013, at 13:32, Sven Van Caekenberghe <[hidden email]> wrote:
> > >>>>
> > >>>>> If anyone is interested, I can write another email explaining how you can run this demo for yourself on your own account.
> > >>>>
> > >>>> How to run the Dropbox code yourself:
> > >>>>
> > >>>> 1. Get yourself a free Dropbox account at http://www.dropbox.com
> > >>>>
> > >>>> 2. Install some client software on one or more of your computers (Mac, Windows, Linux) or devices (iOS [iPhone, iPad, iPod], Android, BlackBerry, Kindle Fire) and move some files around to get a feel for the service.
> > >>>>
> > >>>> 3. When you give other applications access to (part of) your Dropbox files, you can check that at https://www.dropbox.com/account#applications
> > >>>>
> > >>>> 4. Define your own app that will try to access Dropbox files. Go to https://www.dropbox.com/developers (Developer home) and start defining a new app by clicking the 'Create an app' button at https://www.dropbox.com/developers/apps - start with the access type 'App folder'.
> > >>>>
> > >>>> 5. The two important elements you need are the 'App key' and 'App secret', make sure to copy them correctly.
> > >>>>
> > >>>> 6. Get the very latest code in your image (we develop in Pharo 2.0, but 1.4 or even 1.3 should work - SSL has to be fully operational).
> > >>>>
> > >>>> Gofer it
> > >>>>  url: 'http://mc.stfx.eu/ZincHTTPComponents';
> > >>>>  package: 'ConfigurationOfZincHTTPComponents';
> > >>>>  load.
> > >>>>
> > >>>> ConfigurationOfZincHTTPComponents project latestVersion load: 'SSO'.
> > >>>>
> > >>>> 7. Start a Zn server with an appropriate delegate, configured for your app
> > >>>>
> > >>>> (ZnServer startDefaultOn: 8100)
> > >>>>        logToTranscript;
> > >>>>        debugMode: true;
> > >>>>        delegate: (ZnSSOServerDelegate new
> > >>>>                dropboxData: (ZnOAuth1ConsumerData newForDropbox
> > >>>>                                                                consumer: 'vqz-app-key-zoca';
> > >>>>                                                                consumerSecret: '13u-app-secret-8l006';
> > >>>>                                                                yourself);
> > >>>>                yourself).
> > >>>>
> > >>>> (The above is a demo setup limited to Dropbox, the other demos are not configured and won't work).
> > >>>>
> > >>>> 8. Go to http:://localhost:8100/sso-dropbox and click the link to log in - you will be transferred to Dropbox to log in (if you aren't already) and asked to authorise your demo app, after which Dropbox will redirect you back to your app.
> > >>>>
> > >>>> 9. Once back in your app, sso-dropbox-callback (#ssoDropboxCallback:) will access your account info and list the app root folder, which will then be shown.
> > >>>>
> > >>>> 10. For the rest of the API, (currently not yet implemented), see https://www.dropbox.com/developers/reference/api - you don't have to worry about the whole authentication thanks to Zinc-SSO.
> > >>>>
> > >>>> We would love for others to try this (as well as the other Zinc-SSO options, Google, Facebook, Twitter) out, in their own projects, and to provide actual feedback and generally help improve the code and documentation.
> > >>>>
> > >>>> As always, May the Source be with you!
> > >>>>
> > >>>> Sven
> > >>>>
> > >>>> PS: The demo app is not (yet) a production app: only you and up to 5 explicitly listed users can use it. You have to apply for production status later on. Also, the whole ZnSSOServerDelegate code is a demo, for an actual project, it would be best to extract the necessary parts out of it, reusing the underlying Zinc-SSO-OAuth1-Core framework.
> > >>>>
> > >>>> --
> > >>>> Sven Van Caekenberghe
> > >>>> http://stfx.eu
> > >>>> Smalltalk is the Red Pill
> > >>>>
> > >>>>
> >
>
>
>



Reply | Threaded
Open this post in threaded view
|

Re: [Update] Zinc-SSO now supports Dropbox !

Sven Van Caekenberghe-2

On 07 Feb 2013, at 16:37, Sabine Knöfel <[hidden email]> wrote:

> Hi Sven,
>
> sorry, I think there is something basic, that I miss.
>
> In my >>renderContentOn: , I call >>renderDropboxHeadingOn:
>
> renderDropboxHeadingOn: html
>     | theOauthService theRequestToken theUrl theUserAssess theConsumerData |
>       theConsumerData := ZnOAuth1ConsumerData newForDropbox
>         consumer: 'ql5uuynlvybiqp3';
>         consumerSecret: 'hwjrqa8qnxwxxxx';
>         yourself.
>     theOauthService := ZnOAuth1Service new
>         providerAccount: theConsumerData;
>         yourself.        
>     theRequestToken := theOauthService getRequestToken.
>     theUserAssess := ZnOAuth1DropboxUserAccess new
>         oauth1Service: theOauthService;
>         accessToken: theRequestToken.  
>     "===>>> self dropboxSessionFor: request put: requestToken."
>     theUrl := (theOauthService loginUrlFor: theRequestToken callbackUrl: 'http://localhost:8100/sso-dropbox-callback')
>         asString.
>     html anchor
>         script: html jQuery this button;
>         onClick: (html prototype evaluator callback: [ :script |   ]);
>         url: theUrl;
>         with: 'Save data in dropbox'
>
> Click on this button leads me to the dropbox-grant-access page -> ok, thats what I wanted.
>
> In the demo code, >>ssoDropbox:,  the requestToken is assigned to the ZnServerSession instance:
> self dropboxSessionFor: request  put: requestToken.
>
> Because I do not have the ZnServerSession instance within my subclass of WAApplication, I did not assign it.
> This leads to "Not a valid callback request" error, because in >>ssoDropboxData:, the accessToken can not be found.
> This is clear, because I did not assign it ;-)
>
> The question is how to solve this in the right way.

Yes, the request token has to be put in some HTTP session so that it becomes available when the callback runs. I just looked at the Seaside code, but I can't find where the magic happens. Maybe you understand it better than me, or maybe Jan can comment.

> Where can I find the code/package of the seaside demo app from Jan?

It is in the main Zn repository: http://mc.stfx.eu

> I found this: http://forum.world.st/Update-Zinc-SSO-OAuth-2-0-Alpha-Code-amp-Live-Demos-td4660771.html#a4660911
> but http://sso.doit.st did not work.

That is for Jan to solve...

> Thank you for your help.
> Sabine
>
>
>
>
>        
>        
>          
>
>
> On Thu, Feb 7, 2013 at 1:04 PM, Sven Van Caekenberghe <[hidden email]> wrote:
>
> On 07 Feb 2013, at 12:04, Sabine Knöfel <[hidden email]> wrote:
>
> > Hi Sven,
> >
> > I created the ZnOAuth1DropboxUserAccess with the ZnOAuth1Service and ZnOAuth1ConsumerData instances in it. Then I assigned the accessToken from an inspector.
> >
> > That worked. I was able to read the file from the dropbox with getFile:. Great!
> >
> > I used that code (please note "STON fromString: in contents asString ")
> >
> > save the ZnOAuth1DropboxUserAccess as file:
> > (Path * 'plonk.txt') asFileReference
> >     fileStreamDo: [ :stream |
> >         STON put: self onStreamPretty: stream ].
> >
> > Read and create the ZnOAuth1DropboxUserAccess  instance and then get contents of the demo file
> > ((Path * 'plonk.ston') asFileReference
> >         readStreamDo: [ :in | STON fromString: in contents asString    ]) getFile: #( 'demo.txt' ).
> >
> > This is fine.
> > My next question is how can I create an instance of ZnOAuth1Token from WITHIN my application?
> >
> > When I need this ZnOAuth1Token, I am in a subclass of WAComponent.
> > I don't want the user to click at a link like localhost:8100/sso-dropbox.
>
> Sure, look at the implementation of #ssoDropbox:
> You already know how to create the service object (#dropboxOAuth1Service),
> next you need a request token (#getRequestToken).
> Both of these steps don't require user interaction.
>
> The URL you are looking for is constructed as follows:
>
> oauthService loginUrlFor: requestToken callbackUrl: request server url / 'sso-dropbox-callback'
>
> The callback URL has to point to your Seaside app somewhere.
>
> The difference you are looking for is also visible (for other providers) in the difference between #ssoDemo: and #ssoGoogle: for example (that is, the direct link vs the embedded link).
>
> Note that the Zinc-SSO project has a complete Seaside demo as well (Jan wrote that one, it just doesn't include the Dropbox code (yet, hint, hint)), if you know Seaside it will certainly help to look at that code.
>
> You'll have to do this login (ask for Dropbox access) only once, store the tokens that come back and from then on, you should be able to keep using the user access object (if you store it somewhere).
>
> Let me know how it goes.
>
> Sven
>
> > Clicking at a button within my application should send the user directly to the dropbox page to grant access and create the ZnOAuth1Token.
> >
> > Cold you perhaps create a small code example like this
> >
> > renderContentOn: method
> >
> >     html anchor
> >         script: html jQuery this button;
> >         url: '???http://localhost:8100/sso-dropbox???';
> >         with: 'send me to dropbox, create ZnOAuth1Token and return it in some way'.
> >
> > Greetings
> > Sabine
> >
> >
> >
> >
> > On Tue, Feb 5, 2013 at 5:22 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> > Sabine,
> >
> > On 05 Feb 2013, at 14:45, Sabine Knöfel <[hidden email]> wrote:
> >
> > > Hi Sven,
> > >
> > > great! The file was created in my dropbox account:-)
> >
> > And it will be read, updated and written from now on, every time you run the demo.
> >
> > > I will try to use it now in my application and will come back with questions if they occur.
> >
> > Yesterday I used STON to serialize a ZnOAuth1DropboxUserAccess instance that was created from the demo web app demo.
> >
> > To make such an instance you use the codes that were also needed to set up the web demo and the 2 part access token that the web app requested and was granted by the user. To access this token, you currently have to inspect/explore the sessions in the ZnServer instance (there will normally only be one) and assign it to the following object (this is all in hack/debug mode):
> >
> > | data service |
> >
> > data := ZnOAuth1ConsumerData newForDropbox
> >         consumer: 'vqzexpgl5rvzXXX';
> >         consumerSecret: '13uygcdbou8lXXX';
> >         yourself.
> >
> > service := ZnOAuth1Service new
> >         providerAccount: data ;
> >         yourself.
> >
> > ZnOAuth1DropboxUserAccess new
> >         oauth1Service: service;
> >         yourself.
> >
> > (And send it #accessToken:).
> >
> > This will give you a representation like this:
> >
> > ZnOAuth1DropboxUserAccess {
> >         #oauth1Service : ZnOAuth1Service {
> >                 #providerAccount : ZnOAuth1ConsumerData {
> >                         #getRequestTokenUrl : 'https://api.dropbox.com/1/oauth/request_token',
> >                         #authorizeTokenUrl : 'https://www.dropbox.com/1/oauth/authorize',
> >                         #getAccessTokenUrl : 'https://api.dropbox.com/1/oauth/access_token',
> >                         #consumer : 'vqzexpgl5rvzXXX',
> >                         #consumerSecret : '13uygcdbou8lXXX',
> >                         #accessTokenClass : nil
> >                 }
> >         },
> >         #accessToken : ZnOAuth1Token {
> >                 #value : 'qdcm6mivqesdXXX',
> >                 #secret : '39w7r9wqamdgXXX',
> >                 #sessionid : nil
> >         }
> > }
> >
> > I don't know what the lifetime is of this, but from other apps using Dropbox I am guessing it must be pretty long, even close to infinite.
> > So one day later, with the demo web app long gone and image restarted, I can do this:
> >
> > ('ZnOAuth1DropboxUserAccess.ston' asFileReference
> >         readStreamDo: [ :in | STON fromString: in ]) getFile: #( 'demo.txt' ).
> >
> > And it just works.
> >
> > Now, we have to work out a way to make this flow easier and secure at the same time.
> >
> > > Thank you very much.
> >
> > We wrote this so that others can use it, so we are happy with other developers trying out our stuff.
> >
> > Thanks for testing and for the feedback.
> >
> > Sven
> >
> > > Sabine
> > >
> > > On Mon, Feb 4, 2013 at 12:52 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> > >
> > > On 30 Jan 2013, at 19:13, Sven Van Caekenberghe <[hidden email]> wrote:
> > >
> > > > On 30 Jan 2013, at 18:32, Sabine Knöfel <[hidden email]> wrote:
> > > >
> > > >> Sven,
> > > >>
> > > >> could you provide a simple code fragment which shows how to write and how to read a file from the smalltalk image to the connected dropbox app folder?
> > > >
> > > > The whole API is not (yet) implemented.
> > > >
> > > >  https://www.dropbox.com/developers/reference/api
> > > >
> > > > Have a look at ZnOAuth1TwitterUserAccess.
> > > >
> > > > If I find more time, I might try myself.
> > > >
> > > > GET is pretty straightforward, for PUT or POST you will have to supply a ZnEntity of a specific mime-type with bytes or a string.
> > > >
> > > > Note that for file access the host is different.
> > >
> > > I added a bit more Dropbox API and a little demo accessing files.
> > >
> > > There is now #manipulateDemoFile: which will try to access a file called 'demo.txt' and read an id out of it. If found the file is written again, with the id increased and some other fields updated as well. If the file did not exist, it is created with id 1. All this happens automatically if you access /sso-dropbox and log in. You'll get the updated id in the web page and you'll see your Dropbox client doing a local update immediately!
> > >
> > > Here are the details (http://mc.stfx.eu/Zinc-HTTP-Components):
> > >
> > > ---
> > > Name: Zinc-SSO-OAuth1-Core-SvenVanCaekenberghe.13
> > > Author: SvenVanCaekenberghe
> > > Time: 4 February 2013, 12:27:12.196 pm
> > > UUID: 3d78a965-462e-4a4e-94aa-1779369aecb8
> > > Ancestors: Zinc-SSO-OAuth1-Core-SvenVanCaekenberghe.12
> > >
> > > extended ZnOAuth1Service with #httpDelete:using: #httpPost:with:using: #httpPut:with:using:
> > > extended ZnOAuth1DropboxUserAccess with #getFile: and #putFile:data:
> > > some refactoring in ZnOAuth1DropboxUserAccess
> > > ---
> > > Name: Zinc-SSO-Demo-SvenVanCaekenberghe.5
> > > Author: SvenVanCaekenberghe
> > > Time: 4 February 2013, 12:28:14.601 pm
> > > UUID: 4bb17785-f885-4db5-98f5-9c7d52d3add6
> > > Ancestors: Zinc-SSO-Demo-SvenVanCaekenberghe.4
> > >
> > > added ZnSSOServerDelegate>>#manipulateDemoFile:
> > > ---
> > >
> > > This should get you started.
> > >
> > > Note that it is not necessary to log in each time: the access token is valid until you get an unauthorized response.
> > > With the access token and the consumer data you can create service objects separate from the web app that did the setup.
> > >
> > > HTH,
> > >
> > > Sven
> > >
> > >
> > > >> Greetings
> > > >> Sabine
> > > >>
> > > >> On Wed, Jan 30, 2013 at 6:00 PM, Sabine Knöfel <[hidden email]> wrote:
> > > >> Hi Sven,
> > > >>
> > > >> there was only missing loading Zodiac, the dll (windows) was already included in the 1 klick image.
> > > >>
> > > >> Gofer it
> > > >>  squeaksource: 'Zodiac';
> > > >>  package: 'Zodiac-Core';
> > > >>  package: 'Zodiac-Tests';
> > > >>  load.
> > > >>
> > > >> It works. I play around now.
> > > >> Thank you very much!
> > > >> Sabine
> > > >>
> > > >>
> > > >> On Wed, Jan 30, 2013 at 5:38 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> > > >>
> > > >> On 30 Jan 2013, at 17:21, Sabine Knöfel <[hidden email]> wrote:
> > > >>
> > > >>> Hi Sven, hi Jan,
> > > >>>
> > > >>> thank you.
> > > >>> I am one step further now but there must be something else missing to load.
> > > >>> I failed with my current image, so I tried the following:
> > > >>>
> > > >>> I took a fresh image - the Pharo 1.4. one click app from the pharo homepage
> > > >>> (http://gforge.inria.fr/frs/download.php/31258/Pharo-1.4-14557-OneClick.zip)
> > > >>>
> > > >>> Then I loaded seaside 3.0 (from the welcome screen - MetacelloConfigurationBrowser open).
> > > >>>
> > > >>> After that, I loaded
> > > >>>
> > > >>> Gofer it
> > > >>>  url: 'http://mc.stfx.eu/ZincHTTPComponents';
> > > >>>  package: 'ConfigurationOfZincHTTPComponents';
> > > >>>  load.
> > > >>>
> > > >>> And then the bleeding Edge version
> > > >>> ConfigurationOfZincHTTPComponents project bleedingEdge load: 'SSO'.
> > > >>>
> > > >>> Then this was possible:
> > > >>> (ZnServer startDefaultOn: 8100)
> > > >>>        logToTranscript;
> > > >>>        debugMode: true;
> > > >>>        delegate: (ZnSSOServerDelegate new
> > > >>>                dropboxData: (ZnOAuth1ConsumerData newForDropbox
> > > >>>                                                                consumer: 'my appdata';
> > > >>>                                                                consumerSecret: 'my appdata';
> > > >>>                                                                yourself);
> > > >>>                yourself).
> > > >>>
> > > >>> No I tried in my browser
> > > >>> localhost:8100/sso-dropbox
> > > >>>
> > > >>> Then I got a walkback in my Image: No secure socket stream class set or available
> > > >>
> > > >> Well, the error says it all: you need TLS/SSL support. As is noted in
> > > >>
> > > >>  https://github.com/svenvc/docs/blob/master/zinc/zinc-sso-paper.md#installation
> > > >>
> > > >> You can get Zodiac to work in 1.4
> > > >>
> > > >>  http://zdc.stfx.eu
> > > >>
> > > >> Don't forget that you also need the plugin next to your VM !
> > > >>
> > > >> In Pharo 2.0 Zodiac is included by default the latest VM's there should have the plugin.
> > > >> But in 2.0 it will be slightly more difficult to load Seaside, but it does work.
> > > >>
> > > >> Sorry, but all this is still a bit in motion, hopefully you will keep trying.
> > > >>
> > > >>> ==>> I do not have the class ZdcSecureSocketStream in my Image
> > > >>> self secureSocketStreamClass is Nil in
> > > >>>
> > > >>> streamClassForScheme: scheme
> > > >>>    (#(http ws) includes: scheme) ifTrue: [
> > > >>>        ^ self socketStreamClass ].
> > > >>>    (#(https wss) includes: scheme) ifTrue: [
> > > >>>        ^ self secureSocketStreamClass ifNil: [
> > > >>>            self error: 'No secure socket stream class set or available' ] ].
> > > >>>    (ZnUnknownScheme scheme: scheme) signal
> > > >>>
> > > >>> Can you tell me what is missing to load?
> > > >>>
> > > >>> Greetings
> > > >>> Sabine
> > > >>>
> > > >>>
> > > >>> 30 January 2013 5:14:22.402 pm
> > > >>>
> > > >>> ZnNetworkingUtils(Object)>>error:
> > > >>>    Receiver: a ZnNetworkingUtils
> > > >>>    Arguments and temporary variables:
> > > >>>        aString:     'No secure socket stream class set or available'
> > > >>>    Receiver's instance variables:
> > > >>>        socketStreamClass:     SocketStream
> > > >>>        secureSocketStreamClass:     nil
> > > >>>
> > > >>> ZnNetworkingUtils>>streamClassForScheme:
> > > >>>    Receiver: a ZnNetworkingUtils
> > > >>>    Arguments and temporary variables:
> > > >>>        scheme:     #https
> > > >>>    Receiver's instance variables:
> > > >>>        socketStreamClass:     SocketStream
> > > >>>        secureSocketStreamClass:     nil
> > > >>>
> > > >>> ZnNetworkingUtils>>socketStreamToUrlDirectly:
> > > >>>    Receiver: a ZnNetworkingUtils
> > > >>>    Arguments and temporary variables:
> > > >>>        url:     https://api.dropbox.com/1/oauth/request_token
> > > >>>        stream:     nil
> > > >>>        address:     #[199 47 218 158]
> > > >>>    Receiver's instance variables:
> > > >>>        socketStreamClass:     SocketStream
> > > >>>        secureSocketStreamClass:     nil
> > > >>>
> > > >>> ZnNetworkingUtils>>socketStreamToUrl:
> > > >>>    Receiver: a ZnNetworkingUtils
> > > >>>    Arguments and temporary variables:
> > > >>>        url:     https://api.dropbox.com/1/oauth/request_token
> > > >>>    Receiver's instance variables:
> > > >>>        socketStreamClass:     SocketStream
> > > >>>        secureSocketStreamClass:     nil
> > > >>>
> > > >>>
> > > >>>
> > > >>>
> > > >>> On Wed, Jan 30, 2013 at 4:37 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> > > >>> Sabine,
> > > >>>
> > > >>> On 30 Jan 2013, at 16:24, Sabine Knöfel <[hidden email]> wrote:
> > > >>>
> > > >>>> Hi Sven,
> > > >>>>
> > > >>>> after loading:
> > > >>>>
> > > >>>> Gofer it
> > > >>>>  url: 'http://mc.stfx.eu/ZincHTTPComponents';
> > > >>>>  package: 'ConfigurationOfZincHTTPComponents';
> > > >>>>  load.
> > > >>>>
> > > >>>> ConfigurationOfZincHTTPComponents project latestVersion load: 'SSO'.
> > > >>>>
> > > >>>> The ZnOAuth1ConsumerData does not have a method called >>newForDropbox (but >>newForGoogle and >>newForTwitter).
> > > >>>> Also, ZnSSOServerDelegate does not have a method >>dropboxData: (but facebook, twittter and google)
> > > >>>>
> > > >>>> Did I miss something?
> > > >>>
> > > >>> Yes and no. The latest stable version of the configuration does not yet include the Dropbox code.
> > > >>> The following will load what is called bleedingEdge, the very latest version of everything, regardless of its release status.
> > > >>>
> > > >>>  ConfigurationOfZincHTTPComponents project bleedingEdge load: 'SSO'.
> > > >>>
> > > >>> Sorry about that.
> > > >>>
> > > >>> Sven
> > > >>>
> > > >>>> Greetings
> > > >>>> Sabine
> > > >>>>
> > > >>>>
> > > >>>> On Sun, Jan 27, 2013 at 8:47 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> > > >>>>
> > > >>>> On 27 Jan 2013, at 13:32, Sven Van Caekenberghe <[hidden email]> wrote:
> > > >>>>
> > > >>>>> If anyone is interested, I can write another email explaining how you can run this demo for yourself on your own account.
> > > >>>>
> > > >>>> How to run the Dropbox code yourself:
> > > >>>>
> > > >>>> 1. Get yourself a free Dropbox account at http://www.dropbox.com
> > > >>>>
> > > >>>> 2. Install some client software on one or more of your computers (Mac, Windows, Linux) or devices (iOS [iPhone, iPad, iPod], Android, BlackBerry, Kindle Fire) and move some files around to get a feel for the service.
> > > >>>>
> > > >>>> 3. When you give other applications access to (part of) your Dropbox files, you can check that at https://www.dropbox.com/account#applications
> > > >>>>
> > > >>>> 4. Define your own app that will try to access Dropbox files. Go to https://www.dropbox.com/developers (Developer home) and start defining a new app by clicking the 'Create an app' button at https://www.dropbox.com/developers/apps - start with the access type 'App folder'.
> > > >>>>
> > > >>>> 5. The two important elements you need are the 'App key' and 'App secret', make sure to copy them correctly.
> > > >>>>
> > > >>>> 6. Get the very latest code in your image (we develop in Pharo 2.0, but 1.4 or even 1.3 should work - SSL has to be fully operational).
> > > >>>>
> > > >>>> Gofer it
> > > >>>>  url: 'http://mc.stfx.eu/ZincHTTPComponents';
> > > >>>>  package: 'ConfigurationOfZincHTTPComponents';
> > > >>>>  load.
> > > >>>>
> > > >>>> ConfigurationOfZincHTTPComponents project latestVersion load: 'SSO'.
> > > >>>>
> > > >>>> 7. Start a Zn server with an appropriate delegate, configured for your app
> > > >>>>
> > > >>>> (ZnServer startDefaultOn: 8100)
> > > >>>>        logToTranscript;
> > > >>>>        debugMode: true;
> > > >>>>        delegate: (ZnSSOServerDelegate new
> > > >>>>                dropboxData: (ZnOAuth1ConsumerData newForDropbox
> > > >>>>                                                                consumer: 'vqz-app-key-zoca';
> > > >>>>                                                                consumerSecret: '13u-app-secret-8l006';
> > > >>>>                                                                yourself);
> > > >>>>                yourself).
> > > >>>>
> > > >>>> (The above is a demo setup limited to Dropbox, the other demos are not configured and won't work).
> > > >>>>
> > > >>>> 8. Go to http:://localhost:8100/sso-dropbox and click the link to log in - you will be transferred to Dropbox to log in (if you aren't already) and asked to authorise your demo app, after which Dropbox will redirect you back to your app.
> > > >>>>
> > > >>>> 9. Once back in your app, sso-dropbox-callback (#ssoDropboxCallback:) will access your account info and list the app root folder, which will then be shown.
> > > >>>>
> > > >>>> 10. For the rest of the API, (currently not yet implemented), see https://www.dropbox.com/developers/reference/api - you don't have to worry about the whole authentication thanks to Zinc-SSO.
> > > >>>>
> > > >>>> We would love for others to try this (as well as the other Zinc-SSO options, Google, Facebook, Twitter) out, in their own projects, and to provide actual feedback and generally help improve the code and documentation.
> > > >>>>
> > > >>>> As always, May the Source be with you!
> > > >>>>
> > > >>>> Sven
> > > >>>>
> > > >>>> PS: The demo app is not (yet) a production app: only you and up to 5 explicitly listed users can use it. You have to apply for production status later on. Also, the whole ZnSSOServerDelegate code is a demo, for an actual project, it would be best to extract the necessary parts out of it, reusing the underlying Zinc-SSO-OAuth1-Core framework.
> > > >>>>
> > > >>>> --
> > > >>>> Sven Van Caekenberghe
> > > >>>> http://stfx.eu
> > > >>>> Smalltalk is the Red Pill
> > > >>>>
> > > >>>>
> > >
> >
> >
> >
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: [Update] Zinc-SSO now supports Dropbox !

Jan van de Sandt
In reply to this post by Sabine Manaa
Hello Sabine

Dropbox uses OAuth1, handling this is a bit more complicated than OAuth2 because you need to keep track of the requestToken during the sign-on proces. In a Seaside application you can store the requestToken in the session. But than you have to be careful to preserve the session in the redirect to Dropbox and back.

Twitter also uses OAuth1, if you look at the classes ZnSSOSeasideDemo and ZnSSOSeasideTwitterOAuth1DemoPanel in the packge Zinc-SSO-Seaside-Demo you can see an example of how this can be done.

Jan.

PS: http://sso.doit.st is back online

On Thu, Feb 7, 2013 at 4:37 PM, Sabine Knöfel <[hidden email]> wrote:
Hi Sven,

sorry, I think there is something basic, that I miss.

In my >>renderContentOn: , I call >>renderDropboxHeadingOn:

renderDropboxHeadingOn: html
    | theOauthService theRequestToken theUrl theUserAssess theConsumerData |
      theConsumerData := ZnOAuth1ConsumerData newForDropbox
        consumer: 'ql5uuynlvybiqp3';
        consumerSecret: 'hwjrqa8qnxwxxxx';
        yourself.
    theOauthService := ZnOAuth1Service new
        providerAccount: theConsumerData;
        yourself.       
    theRequestToken := theOauthService getRequestToken.
    theUserAssess := ZnOAuth1DropboxUserAccess new
        oauth1Service: theOauthService;
        accessToken: theRequestToken. 
    "===>>> self dropboxSessionFor: request put: requestToken."
    theUrl := (theOauthService loginUrlFor: theRequestToken callbackUrl: 'http://localhost:8100/sso-dropbox-callback')
        asString.

    html anchor
        script: html jQuery this button;
        onClick: (html prototype evaluator callback: [ :script |   ]);
        url: theUrl;
        with: 'Save data in dropbox'

Click on this button leads me to the dropbox-grant-access page -> ok, thats what I wanted.

In the demo code, >>ssoDropbox:,  the requestToken is assigned to the ZnServerSession instance:
self dropboxSessionFor: request  put: requestToken.

Because I do not have the ZnServerSession instance within my subclass of WAApplication, I did not assign it.
This leads to "Not a valid callback request" error, because in >>ssoDropboxData:, the accessToken can not be found.
This is clear, because I did not assign it ;-)

The question is how to solve this in the right way.

Where can I find the code/package of the seaside demo app from Jan?
I found this: http://forum.world.st/Update-Zinc-SSO-OAuth-2-0-Alpha-Code-amp-Live-Demos-td4660771.html#a4660911
but http://sso.doit.st did not work.

Thank you for your help.
Sabine





       
       
        


On Thu, Feb 7, 2013 at 1:04 PM, Sven Van Caekenberghe <[hidden email]> wrote:

On 07 Feb 2013, at 12:04, Sabine Knöfel <[hidden email]> wrote:

> Hi Sven,
>
> I created the ZnOAuth1DropboxUserAccess with the ZnOAuth1Service and ZnOAuth1ConsumerData instances in it. Then I assigned the accessToken from an inspector.
>
> That worked. I was able to read the file from the dropbox with getFile:. Great!
>
> I used that code (please note "STON fromString: in contents asString ")
>
> save the ZnOAuth1DropboxUserAccess as file:
> (Path * 'plonk.txt') asFileReference
>     fileStreamDo: [ :stream |
>         STON put: self onStreamPretty: stream ].
>
> Read and create the ZnOAuth1DropboxUserAccess  instance and then get contents of the demo file
> ((Path * 'plonk.ston') asFileReference
>         readStreamDo: [ :in | STON fromString: in contents asString    ]) getFile: #( 'demo.txt' ).
>
> This is fine.
> My next question is how can I create an instance of ZnOAuth1Token from WITHIN my application?
>
> When I need this ZnOAuth1Token, I am in a subclass of WAComponent.
> I don't want the user to click at a link like localhost:8100/sso-dropbox.

Sure, look at the implementation of #ssoDropbox:
You already know how to create the service object (#dropboxOAuth1Service),
next you need a request token (#getRequestToken).
Both of these steps don't require user interaction.

The URL you are looking for is constructed as follows:

oauthService loginUrlFor: requestToken callbackUrl: request server url / 'sso-dropbox-callback'

The callback URL has to point to your Seaside app somewhere.

The difference you are looking for is also visible (for other providers) in the difference between #ssoDemo: and #ssoGoogle: for example (that is, the direct link vs the embedded link).

Note that the Zinc-SSO project has a complete Seaside demo as well (Jan wrote that one, it just doesn't include the Dropbox code (yet, hint, hint)), if you know Seaside it will certainly help to look at that code.

You'll have to do this login (ask for Dropbox access) only once, store the tokens that come back and from then on, you should be able to keep using the user access object (if you store it somewhere).

Let me know how it goes.

Sven

> Clicking at a button within my application should send the user directly to the dropbox page to grant access and create the ZnOAuth1Token.
>
> Cold you perhaps create a small code example like this
>
> renderContentOn: method
>
>     html anchor
>         script: html jQuery this button;
>         url: '???http://localhost:8100/sso-dropbox???';
>         with: 'send me to dropbox, create ZnOAuth1Token and return it in some way'.
>
> Greetings
> Sabine
>
>
>
>
> On Tue, Feb 5, 2013 at 5:22 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> Sabine,
>
> On 05 Feb 2013, at 14:45, Sabine Knöfel <[hidden email]> wrote:
>
> > Hi Sven,
> >
> > great! The file was created in my dropbox account:-)
>
> And it will be read, updated and written from now on, every time you run the demo.
>
> > I will try to use it now in my application and will come back with questions if they occur.
>
> Yesterday I used STON to serialize a ZnOAuth1DropboxUserAccess instance that was created from the demo web app demo.
>
> To make such an instance you use the codes that were also needed to set up the web demo and the 2 part access token that the web app requested and was granted by the user. To access this token, you currently have to inspect/explore the sessions in the ZnServer instance (there will normally only be one) and assign it to the following object (this is all in hack/debug mode):
>
> | data service |
>
> data := ZnOAuth1ConsumerData newForDropbox
>         consumer: 'vqzexpgl5rvzXXX';
>         consumerSecret: '13uygcdbou8lXXX';
>         yourself.
>
> service := ZnOAuth1Service new
>         providerAccount: data ;
>         yourself.
>
> ZnOAuth1DropboxUserAccess new
>         oauth1Service: service;
>         yourself.
>
> (And send it #accessToken:).
>
> This will give you a representation like this:
>
> ZnOAuth1DropboxUserAccess {
>         #oauth1Service : ZnOAuth1Service {
>                 #providerAccount : ZnOAuth1ConsumerData {
>                         #getRequestTokenUrl : 'https://api.dropbox.com/1/oauth/request_token',
>                         #authorizeTokenUrl : 'https://www.dropbox.com/1/oauth/authorize',
>                         #getAccessTokenUrl : 'https://api.dropbox.com/1/oauth/access_token',
>                         #consumer : 'vqzexpgl5rvzXXX',
>                         #consumerSecret : '13uygcdbou8lXXX',
>                         #accessTokenClass : nil
>                 }
>         },
>         #accessToken : ZnOAuth1Token {
>                 #value : 'qdcm6mivqesdXXX',
>                 #secret : '39w7r9wqamdgXXX',
>                 #sessionid : nil
>         }
> }
>
> I don't know what the lifetime is of this, but from other apps using Dropbox I am guessing it must be pretty long, even close to infinite.
> So one day later, with the demo web app long gone and image restarted, I can do this:
>
> ('ZnOAuth1DropboxUserAccess.ston' asFileReference
>         readStreamDo: [ :in | STON fromString: in ]) getFile: #( 'demo.txt' ).
>
> And it just works.
>
> Now, we have to work out a way to make this flow easier and secure at the same time.
>
> > Thank you very much.
>
> We wrote this so that others can use it, so we are happy with other developers trying out our stuff.
>
> Thanks for testing and for the feedback.
>
> Sven
>
> > Sabine
> >
> > On Mon, Feb 4, 2013 at 12:52 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> >
> > On 30 Jan 2013, at 19:13, Sven Van Caekenberghe <[hidden email]> wrote:
> >
> > > On 30 Jan 2013, at 18:32, Sabine Knöfel <[hidden email]> wrote:
> > >
> > >> Sven,
> > >>
> > >> could you provide a simple code fragment which shows how to write and how to read a file from the smalltalk image to the connected dropbox app folder?
> > >
> > > The whole API is not (yet) implemented.
> > >
> > >  https://www.dropbox.com/developers/reference/api
> > >
> > > Have a look at ZnOAuth1TwitterUserAccess.
> > >
> > > If I find more time, I might try myself.
> > >
> > > GET is pretty straightforward, for PUT or POST you will have to supply a ZnEntity of a specific mime-type with bytes or a string.
> > >
> > > Note that for file access the host is different.
> >
> > I added a bit more Dropbox API and a little demo accessing files.
> >
> > There is now #manipulateDemoFile: which will try to access a file called 'demo.txt' and read an id out of it. If found the file is written again, with the id increased and some other fields updated as well. If the file did not exist, it is created with id 1. All this happens automatically if you access /sso-dropbox and log in. You'll get the updated id in the web page and you'll see your Dropbox client doing a local update immediately!
> >
> > Here are the details (http://mc.stfx.eu/Zinc-HTTP-Components):
> >
> > ---
> > Name: Zinc-SSO-OAuth1-Core-SvenVanCaekenberghe.13
> > Author: SvenVanCaekenberghe
> > Time: 4 February 2013, 12:27:12.196 pm
> > UUID: 3d78a965-462e-4a4e-94aa-1779369aecb8
> > Ancestors: Zinc-SSO-OAuth1-Core-SvenVanCaekenberghe.12
> >
> > extended ZnOAuth1Service with #httpDelete:using: #httpPost:with:using: #httpPut:with:using:
> > extended ZnOAuth1DropboxUserAccess with #getFile: and #putFile:data:
> > some refactoring in ZnOAuth1DropboxUserAccess
> > ---
> > Name: Zinc-SSO-Demo-SvenVanCaekenberghe.5
> > Author: SvenVanCaekenberghe
> > Time: 4 February 2013, 12:28:14.601 pm
> > UUID: 4bb17785-f885-4db5-98f5-9c7d52d3add6
> > Ancestors: Zinc-SSO-Demo-SvenVanCaekenberghe.4
> >
> > added ZnSSOServerDelegate>>#manipulateDemoFile:
> > ---
> >
> > This should get you started.
> >
> > Note that it is not necessary to log in each time: the access token is valid until you get an unauthorized response.
> > With the access token and the consumer data you can create service objects separate from the web app that did the setup.
> >
> > HTH,
> >
> > Sven
> >
> >
> > >> Greetings
> > >> Sabine
> > >>
> > >> On Wed, Jan 30, 2013 at 6:00 PM, Sabine Knöfel <[hidden email]> wrote:
> > >> Hi Sven,
> > >>
> > >> there was only missing loading Zodiac, the dll (windows) was already included in the 1 klick image.
> > >>
> > >> Gofer it
> > >>  squeaksource: 'Zodiac';
> > >>  package: 'Zodiac-Core';
> > >>  package: 'Zodiac-Tests';
> > >>  load.
> > >>
> > >> It works. I play around now.
> > >> Thank you very much!
> > >> Sabine
> > >>
> > >>
> > >> On Wed, Jan 30, 2013 at 5:38 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> > >>
> > >> On 30 Jan 2013, at 17:21, Sabine Knöfel <[hidden email]> wrote:
> > >>
> > >>> Hi Sven, hi Jan,
> > >>>
> > >>> thank you.
> > >>> I am one step further now but there must be something else missing to load.
> > >>> I failed with my current image, so I tried the following:
> > >>>
> > >>> I took a fresh image - the Pharo 1.4. one click app from the pharo homepage
> > >>> (http://gforge.inria.fr/frs/download.php/31258/Pharo-1.4-14557-OneClick.zip)
> > >>>
> > >>> Then I loaded seaside 3.0 (from the welcome screen - MetacelloConfigurationBrowser open).
> > >>>
> > >>> After that, I loaded
> > >>>
> > >>> Gofer it
> > >>>  url: 'http://mc.stfx.eu/ZincHTTPComponents';
> > >>>  package: 'ConfigurationOfZincHTTPComponents';
> > >>>  load.
> > >>>
> > >>> And then the bleeding Edge version
> > >>> ConfigurationOfZincHTTPComponents project bleedingEdge load: 'SSO'.
> > >>>
> > >>> Then this was possible:
> > >>> (ZnServer startDefaultOn: 8100)
> > >>>        logToTranscript;
> > >>>        debugMode: true;
> > >>>        delegate: (ZnSSOServerDelegate new
> > >>>                dropboxData: (ZnOAuth1ConsumerData newForDropbox
> > >>>                                                                consumer: 'my appdata';
> > >>>                                                                consumerSecret: 'my appdata';
> > >>>                                                                yourself);
> > >>>                yourself).
> > >>>
> > >>> No I tried in my browser
> > >>> localhost:8100/sso-dropbox
> > >>>
> > >>> Then I got a walkback in my Image: No secure socket stream class set or available
> > >>
> > >> Well, the error says it all: you need TLS/SSL support. As is noted in
> > >>
> > >>  https://github.com/svenvc/docs/blob/master/zinc/zinc-sso-paper.md#installation
> > >>
> > >> You can get Zodiac to work in 1.4
> > >>
> > >>  http://zdc.stfx.eu
> > >>
> > >> Don't forget that you also need the plugin next to your VM !
> > >>
> > >> In Pharo 2.0 Zodiac is included by default the latest VM's there should have the plugin.
> > >> But in 2.0 it will be slightly more difficult to load Seaside, but it does work.
> > >>
> > >> Sorry, but all this is still a bit in motion, hopefully you will keep trying.
> > >>
> > >>> ==>> I do not have the class ZdcSecureSocketStream in my Image
> > >>> self secureSocketStreamClass is Nil in
> > >>>
> > >>> streamClassForScheme: scheme
> > >>>    (#(http ws) includes: scheme) ifTrue: [
> > >>>        ^ self socketStreamClass ].
> > >>>    (#(https wss) includes: scheme) ifTrue: [
> > >>>        ^ self secureSocketStreamClass ifNil: [
> > >>>            self error: 'No secure socket stream class set or available' ] ].
> > >>>    (ZnUnknownScheme scheme: scheme) signal
> > >>>
> > >>> Can you tell me what is missing to load?
> > >>>
> > >>> Greetings
> > >>> Sabine
> > >>>
> > >>>
> > >>> 30 January 2013 5:14:22.402 pm
> > >>>
> > >>> ZnNetworkingUtils(Object)>>error:
> > >>>    Receiver: a ZnNetworkingUtils
> > >>>    Arguments and temporary variables:
> > >>>        aString:     'No secure socket stream class set or available'
> > >>>    Receiver's instance variables:
> > >>>        socketStreamClass:     SocketStream
> > >>>        secureSocketStreamClass:     nil
> > >>>
> > >>> ZnNetworkingUtils>>streamClassForScheme:
> > >>>    Receiver: a ZnNetworkingUtils
> > >>>    Arguments and temporary variables:
> > >>>        scheme:     #https
> > >>>    Receiver's instance variables:
> > >>>        socketStreamClass:     SocketStream
> > >>>        secureSocketStreamClass:     nil
> > >>>
> > >>> ZnNetworkingUtils>>socketStreamToUrlDirectly:
> > >>>    Receiver: a ZnNetworkingUtils
> > >>>    Arguments and temporary variables:
> > >>>        url:     https://api.dropbox.com/1/oauth/request_token
> > >>>        stream:     nil
> > >>>        address:     #[199 47 218 158]
> > >>>    Receiver's instance variables:
> > >>>        socketStreamClass:     SocketStream
> > >>>        secureSocketStreamClass:     nil
> > >>>
> > >>> ZnNetworkingUtils>>socketStreamToUrl:
> > >>>    Receiver: a ZnNetworkingUtils
> > >>>    Arguments and temporary variables:
> > >>>        url:     https://api.dropbox.com/1/oauth/request_token
> > >>>    Receiver's instance variables:
> > >>>        socketStreamClass:     SocketStream
> > >>>        secureSocketStreamClass:     nil
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> On Wed, Jan 30, 2013 at 4:37 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> > >>> Sabine,
> > >>>
> > >>> On 30 Jan 2013, at 16:24, Sabine Knöfel <[hidden email]> wrote:
> > >>>
> > >>>> Hi Sven,
> > >>>>
> > >>>> after loading:
> > >>>>
> > >>>> Gofer it
> > >>>>  url: 'http://mc.stfx.eu/ZincHTTPComponents';
> > >>>>  package: 'ConfigurationOfZincHTTPComponents';
> > >>>>  load.
> > >>>>
> > >>>> ConfigurationOfZincHTTPComponents project latestVersion load: 'SSO'.
> > >>>>
> > >>>> The ZnOAuth1ConsumerData does not have a method called >>newForDropbox (but >>newForGoogle and >>newForTwitter).
> > >>>> Also, ZnSSOServerDelegate does not have a method >>dropboxData: (but facebook, twittter and google)
> > >>>>
> > >>>> Did I miss something?
> > >>>
> > >>> Yes and no. The latest stable version of the configuration does not yet include the Dropbox code.
> > >>> The following will load what is called bleedingEdge, the very latest version of everything, regardless of its release status.
> > >>>
> > >>>  ConfigurationOfZincHTTPComponents project bleedingEdge load: 'SSO'.
> > >>>
> > >>> Sorry about that.
> > >>>
> > >>> Sven
> > >>>
> > >>>> Greetings
> > >>>> Sabine
> > >>>>
> > >>>>
> > >>>> On Sun, Jan 27, 2013 at 8:47 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> > >>>>
> > >>>> On 27 Jan 2013, at 13:32, Sven Van Caekenberghe <[hidden email]> wrote:
> > >>>>
> > >>>>> If anyone is interested, I can write another email explaining how you can run this demo for yourself on your own account.
> > >>>>
> > >>>> How to run the Dropbox code yourself:
> > >>>>
> > >>>> 1. Get yourself a free Dropbox account at http://www.dropbox.com
> > >>>>
> > >>>> 2. Install some client software on one or more of your computers (Mac, Windows, Linux) or devices (iOS [iPhone, iPad, iPod], Android, BlackBerry, Kindle Fire) and move some files around to get a feel for the service.
> > >>>>
> > >>>> 3. When you give other applications access to (part of) your Dropbox files, you can check that at https://www.dropbox.com/account#applications
> > >>>>
> > >>>> 4. Define your own app that will try to access Dropbox files. Go to https://www.dropbox.com/developers (Developer home) and start defining a new app by clicking the 'Create an app' button at https://www.dropbox.com/developers/apps - start with the access type 'App folder'.
> > >>>>
> > >>>> 5. The two important elements you need are the 'App key' and 'App secret', make sure to copy them correctly.
> > >>>>
> > >>>> 6. Get the very latest code in your image (we develop in Pharo 2.0, but 1.4 or even 1.3 should work - SSL has to be fully operational).
> > >>>>
> > >>>> Gofer it
> > >>>>  url: 'http://mc.stfx.eu/ZincHTTPComponents';
> > >>>>  package: 'ConfigurationOfZincHTTPComponents';
> > >>>>  load.
> > >>>>
> > >>>> ConfigurationOfZincHTTPComponents project latestVersion load: 'SSO'.
> > >>>>
> > >>>> 7. Start a Zn server with an appropriate delegate, configured for your app
> > >>>>
> > >>>> (ZnServer startDefaultOn: 8100)
> > >>>>        logToTranscript;
> > >>>>        debugMode: true;
> > >>>>        delegate: (ZnSSOServerDelegate new
> > >>>>                dropboxData: (ZnOAuth1ConsumerData newForDropbox
> > >>>>                                                                consumer: 'vqz-app-key-zoca';
> > >>>>                                                                consumerSecret: '13u-app-secret-8l006';
> > >>>>                                                                yourself);
> > >>>>                yourself).
> > >>>>
> > >>>> (The above is a demo setup limited to Dropbox, the other demos are not configured and won't work).
> > >>>>
> > >>>> 8. Go to http:://localhost:8100/sso-dropbox and click the link to log in - you will be transferred to Dropbox to log in (if you aren't already) and asked to authorise your demo app, after which Dropbox will redirect you back to your app.
> > >>>>
> > >>>> 9. Once back in your app, sso-dropbox-callback (#ssoDropboxCallback:) will access your account info and list the app root folder, which will then be shown.
> > >>>>
> > >>>> 10. For the rest of the API, (currently not yet implemented), see https://www.dropbox.com/developers/reference/api - you don't have to worry about the whole authentication thanks to Zinc-SSO.
> > >>>>
> > >>>> We would love for others to try this (as well as the other Zinc-SSO options, Google, Facebook, Twitter) out, in their own projects, and to provide actual feedback and generally help improve the code and documentation.
> > >>>>
> > >>>> As always, May the Source be with you!
> > >>>>
> > >>>> Sven
> > >>>>
> > >>>> PS: The demo app is not (yet) a production app: only you and up to 5 explicitly listed users can use it. You have to apply for production status later on. Also, the whole ZnSSOServerDelegate code is a demo, for an actual project, it would be best to extract the necessary parts out of it, reusing the underlying Zinc-SSO-OAuth1-Core framework.
> > >>>>
> > >>>> --
> > >>>> Sven Van Caekenberghe
> > >>>> http://stfx.eu
> > >>>> Smalltalk is the Red Pill
> > >>>>
> > >>>>
> >
>
>
>




Reply | Threaded
Open this post in threaded view
|

Re: [Update] Zinc-SSO now supports Dropbox !

Sven Van Caekenberghe-2
In reply to this post by Sven Van Caekenberghe-2

On 07 Feb 2013, at 17:33, Sven Van Caekenberghe <[hidden email]> wrote:

>> Where can I find the code/package of the seaside demo app from Jan?
>
> It is in the main Zn repository: http://mc.stfx.eu

Make that http://mc.stfx.eu/ZincHTTPComponents

There is no GUI to this repository, it is storage only.

Sven

Reply | Threaded
Open this post in threaded view
|

Re: [Update] Zinc-SSO now supports Dropbox !

Sabine Manaa
Hi Sven,

I loaded  ConfigurationOfZincHTTPComponents '2.3.2' from http://mc.stfx.eu.
With this, I have the  ZnSSOSeasideDemo loaded.

But in the register method of ZnSSOSeasideDemo , there are classes referenced, which are not loaded with this Conf.
Where can I find them?
ZnOpenIDConfiguration,
ZnOAuth1TwitterConfiguration,
ZnOAuth2FacebookConfiguration,
ZnOAuth2GoogleConfiguration,
ZnOAuth2MicrosoftConfiguration.

Greetings
Sabine

On Fri, Feb 8, 2013 at 9:08 AM, Sven Van Caekenberghe <[hidden email]> wrote:

On 07 Feb 2013, at 17:33, Sven Van Caekenberghe <[hidden email]> wrote:

>> Where can I find the code/package of the seaside demo app from Jan?
>
> It is in the main Zn repository: http://mc.stfx.eu

Make that http://mc.stfx.eu/ZincHTTPComponents

There is no GUI to this repository, it is storage only.

Sven


Reply | Threaded
Open this post in threaded view
|

Re: [Update] Zinc-SSO now supports Dropbox !

Jan van de Sandt
Hi,

These classes are part of the package Zinc-SSO-Seaside-Support.

Jan.

On Fri, Feb 8, 2013 at 10:37 AM, Sabine Knöfel <[hidden email]> wrote:
Hi Sven,

I loaded  ConfigurationOfZincHTTPComponents '2.3.2' from http://mc.stfx.eu.
With this, I have the  ZnSSOSeasideDemo loaded.

But in the register method of ZnSSOSeasideDemo , there are classes referenced, which are not loaded with this Conf.
Where can I find them?
ZnOpenIDConfiguration,
ZnOAuth1TwitterConfiguration,
ZnOAuth2FacebookConfiguration,
ZnOAuth2GoogleConfiguration,
ZnOAuth2MicrosoftConfiguration.

Greetings
Sabine


On Fri, Feb 8, 2013 at 9:08 AM, Sven Van Caekenberghe <[hidden email]> wrote:

On 07 Feb 2013, at 17:33, Sven Van Caekenberghe <[hidden email]> wrote:

>> Where can I find the code/package of the seaside demo app from Jan?
>
> It is in the main Zn repository: http://mc.stfx.eu

Make that http://mc.stfx.eu/ZincHTTPComponents

There is no GUI to this repository, it is storage only.

Sven



Reply | Threaded
Open this post in threaded view
|

Re: [Update] Zinc-SSO now supports Dropbox !

Sabine Manaa
thanks for the fast reply :-)

On Fri, Feb 8, 2013 at 10:50 AM, Jan van de Sandt <[hidden email]> wrote:

> Hi,
>
> These classes are part of the package Zinc-SSO-Seaside-Support.
>
> Jan.
>
>
> On Fri, Feb 8, 2013 at 10:37 AM, Sabine Knöfel <[hidden email]>
> wrote:
>>
>> Hi Sven,
>>
>> I loaded  ConfigurationOfZincHTTPComponents '2.3.2' from
>> http://mc.stfx.eu.
>> With this, I have the  ZnSSOSeasideDemo loaded.
>>
>> But in the register method of ZnSSOSeasideDemo , there are classes
>> referenced, which are not loaded with this Conf.
>> Where can I find them?
>> ZnOpenIDConfiguration,
>> ZnOAuth1TwitterConfiguration,
>> ZnOAuth2FacebookConfiguration,
>> ZnOAuth2GoogleConfiguration,
>> ZnOAuth2MicrosoftConfiguration.
>>
>> Greetings
>> Sabine
>>
>>
>> On Fri, Feb 8, 2013 at 9:08 AM, Sven Van Caekenberghe <[hidden email]>
>> wrote:
>>>
>>>
>>> On 07 Feb 2013, at 17:33, Sven Van Caekenberghe <[hidden email]> wrote:
>>>
>>> >> Where can I find the code/package of the seaside demo app from Jan?
>>> >
>>> > It is in the main Zn repository: http://mc.stfx.eu
>>>
>>> Make that http://mc.stfx.eu/ZincHTTPComponents
>>>
>>> There is no GUI to this repository, it is storage only.
>>>
>>> Sven
>>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: [Update] Zinc-SSO now supports Dropbox !

Sven Van Caekenberghe-2
In reply to this post by Sabine Manaa
Gofer it
  url: 'http://mc.stfx.eu/ZincHTTPComponents';
  package: 'ConfigurationOfZincHTTPComponents';
  load.

ConfigurationOfZincHTTPComponents project latestVersion load: 'SSO'.

Gofer it
  url: 'http://mc.stfx.eu/ZincHTTPComponents';
  package: 'Zinc-Seaside'; "not necessary, updating to the latest version"
  package: 'Zinc-SSO-Seaside-Support';
  package: 'Zinc-SSO-Seaside-Demo';
  load.

Should load all necessary code (provided you have Seaside already), no ?

But running it is another matter: you need to setup all the providers.
I have done this, but using Jan's credentials, but these can of course not be shared.
I would guess that the demo will not do anything unless these are set up.

Jan, what can be done about this ?

On 08 Feb 2013, at 10:37, Sabine Knöfel <[hidden email]> wrote:

> Hi Sven,
>
> I loaded  ConfigurationOfZincHTTPComponents '2.3.2' from http://mc.stfx.eu.
> With this, I have the  ZnSSOSeasideDemo loaded.
>
> But in the register method of ZnSSOSeasideDemo , there are classes referenced, which are not loaded with this Conf.
> Where can I find them?
> ZnOpenIDConfiguration,
> ZnOAuth1TwitterConfiguration,
> ZnOAuth2FacebookConfiguration,
> ZnOAuth2GoogleConfiguration,
> ZnOAuth2MicrosoftConfiguration.
>
> Greetings
> Sabine
>
> On Fri, Feb 8, 2013 at 9:08 AM, Sven Van Caekenberghe <[hidden email]> wrote:
>
> On 07 Feb 2013, at 17:33, Sven Van Caekenberghe <[hidden email]> wrote:
>
> >> Where can I find the code/package of the seaside demo app from Jan?
> >
> > It is in the main Zn repository: http://mc.stfx.eu
>
> Make that http://mc.stfx.eu/ZincHTTPComponents
>
> There is no GUI to this repository, it is storage only.
>
> Sven
>
>


Reply | Threaded
Open this post in threaded view
|

Re: [Update] Zinc-SSO now supports Dropbox !

Jan van de Sandt
Hi,

The Zinc-SSO-Seaside-Support package contains Seaside configuration classes for the required configuration data of the different OAuth/OpenID providers. When you use these classes you don't have to hardcode the specific consumerKey and consumerSecret in your code but you can use the Seaside config web page to setup the correct values.

See ZnSSOSeasideDemo>>#register for an example.

If you want to run the demo you need a registration with at least one of the SSO providers. 

Jan.


On Fri, Feb 8, 2013 at 11:01 AM, Sven Van Caekenberghe <[hidden email]> wrote:
Gofer it
  url: 'http://mc.stfx.eu/ZincHTTPComponents';
  package: 'ConfigurationOfZincHTTPComponents';
  load.

ConfigurationOfZincHTTPComponents project latestVersion load: 'SSO'.

  package: 'Zinc-Seaside';      "not necessary, updating to the latest version"
  package: 'Zinc-SSO-Seaside-Support';
  package: 'Zinc-SSO-Seaside-Demo';
  load.

Should load all necessary code (provided you have Seaside already), no ?

But running it is another matter: you need to setup all the providers.
I have done this, but using Jan's credentials, but these can of course not be shared.
I would guess that the demo will not do anything unless these are set up.

Jan, what can be done about this ?

On 08 Feb 2013, at 10:37, Sabine Knöfel <[hidden email]> wrote:

> Hi Sven,
>
> I loaded  ConfigurationOfZincHTTPComponents '2.3.2' from http://mc.stfx.eu.
> With this, I have the  ZnSSOSeasideDemo loaded.
>
> But in the register method of ZnSSOSeasideDemo , there are classes referenced, which are not loaded with this Conf.
> Where can I find them?
> ZnOpenIDConfiguration,
> ZnOAuth1TwitterConfiguration,
> ZnOAuth2FacebookConfiguration,
> ZnOAuth2GoogleConfiguration,
> ZnOAuth2MicrosoftConfiguration.
>
> Greetings
> Sabine
>
> On Fri, Feb 8, 2013 at 9:08 AM, Sven Van Caekenberghe <[hidden email]> wrote:
>
> On 07 Feb 2013, at 17:33, Sven Van Caekenberghe <[hidden email]> wrote:
>
> >> Where can I find the code/package of the seaside demo app from Jan?
> >
> > It is in the main Zn repository: http://mc.stfx.eu
>
> Make that http://mc.stfx.eu/ZincHTTPComponents
>
> There is no GUI to this repository, it is storage only.
>
> Sven
>
>



Reply | Threaded
Open this post in threaded view
|

Re: [Update] Zinc-SSO now supports Dropbox !

Sabine Manaa
Hi,

thank you, I have it running now. Now I can adopt it in my application.
Thank you very much for your help, Sven and Jan!

Sabine

On Fri, Feb 8, 2013 at 11:51 AM, Jan van de Sandt <[hidden email]> wrote:

> Hi,
>
> The Zinc-SSO-Seaside-Support package contains Seaside configuration classes
> for the required configuration data of the different OAuth/OpenID providers.
> When you use these classes you don't have to hardcode the specific
> consumerKey and consumerSecret in your code but you can use the Seaside
> config web page to setup the correct values.
>
> See ZnSSOSeasideDemo>>#register for an example.
>
> If you want to run the demo you need a registration with at least one of the
> SSO providers.
>
> Jan.
>
>
> On Fri, Feb 8, 2013 at 11:01 AM, Sven Van Caekenberghe <[hidden email]> wrote:
>>
>> Gofer it
>>   url: 'http://mc.stfx.eu/ZincHTTPComponents';
>>   package: 'ConfigurationOfZincHTTPComponents';
>>   load.
>>
>> ConfigurationOfZincHTTPComponents project latestVersion load: 'SSO'.
>>
>> Gofer it
>>   url: 'http://mc.stfx.eu/ZincHTTPComponents';
>>   package: 'Zinc-Seaside';      "not necessary, updating to the latest
>> version"
>>   package: 'Zinc-SSO-Seaside-Support';
>>   package: 'Zinc-SSO-Seaside-Demo';
>>   load.
>>
>> Should load all necessary code (provided you have Seaside already), no ?
>>
>> But running it is another matter: you need to setup all the providers.
>> I have done this, but using Jan's credentials, but these can of course not
>> be shared.
>> I would guess that the demo will not do anything unless these are set up.
>>
>> Jan, what can be done about this ?
>>
>> On 08 Feb 2013, at 10:37, Sabine Knöfel <[hidden email]> wrote:
>>
>> > Hi Sven,
>> >
>> > I loaded  ConfigurationOfZincHTTPComponents '2.3.2' from
>> > http://mc.stfx.eu.
>> > With this, I have the  ZnSSOSeasideDemo loaded.
>> >
>> > But in the register method of ZnSSOSeasideDemo , there are classes
>> > referenced, which are not loaded with this Conf.
>> > Where can I find them?
>> > ZnOpenIDConfiguration,
>> > ZnOAuth1TwitterConfiguration,
>> > ZnOAuth2FacebookConfiguration,
>> > ZnOAuth2GoogleConfiguration,
>> > ZnOAuth2MicrosoftConfiguration.
>> >
>> > Greetings
>> > Sabine
>> >
>> > On Fri, Feb 8, 2013 at 9:08 AM, Sven Van Caekenberghe <[hidden email]>
>> > wrote:
>> >
>> > On 07 Feb 2013, at 17:33, Sven Van Caekenberghe <[hidden email]> wrote:
>> >
>> > >> Where can I find the code/package of the seaside demo app from Jan?
>> > >
>> > > It is in the main Zn repository: http://mc.stfx.eu
>> >
>> > Make that http://mc.stfx.eu/ZincHTTPComponents
>> >
>> > There is no GUI to this repository, it is storage only.
>> >
>> > Sven
>> >
>> >
>>
>>
>

12