Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion OAuth in Lift

Received: by 10.204.6.19 with SMTP id 19mr619690bkx.8.1352376561710;
        Thu, 08 Nov 2012 04:09:21 -0800 (PST)
X-BeenThere: liftweb@googlegroups.com
Received: by 10.204.147.6 with SMTP id j6ls3341821bkv.9.gmail; Thu, 08 Nov
 2012 04:09:12 -0800 (PST)
Received: by 10.204.6.19 with SMTP id 19mr619652bkx.8.1352376552724;
        Thu, 08 Nov 2012 04:09:12 -0800 (PST)
Received: by 10.204.6.19 with SMTP id 19mr619651bkx.8.1352376552684;
        Thu, 08 Nov 2012 04:09:12 -0800 (PST)
Return-Path: <bardadymc...@gmail.com>
Received: from mail-la0-f43.google.com (mail-la0-f43.google.com [209.85.215.43])
        by gmr-mx.google.com with ESMTPS id t1si2445240bkt.1.2012.11.08.04.09.12
        (version=TLSv1/SSLv3 cipher=OTHER);
        Thu, 08 Nov 2012 04:09:12 -0800 (PST)
Received-SPF: pass (google.com: domain of bardadymc...@gmail.com designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of bardadymc...@gmail.com designates 209.85.215.43 as permitted sender) smtp.mail=bardadymc...@gmail.com; dkim=pass header...@gmail.com
Received: by mail-la0-f43.google.com with SMTP id i5so2542509lah.30
        for <liftweb@googlegroups.com>; Thu, 08 Nov 2012 04:09:12 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:message-id:in-reply-to:references:subject:x-mailer
         :mime-version:content-type;
        bh=DPRD7tIsY/TwsuasJWltK0hmC0FjTHLd2slIzf6o40Q=;
        b=Yt/LyZvE9+bFhSky3tlgwVEDEfMZ9O+6tQN6ljvCqFFm1UxknIrJo15Z90mumlq3Xr
         v4BP869erIo+/O1V0PGcfN8DtuPnY2PdeoGf+sQzliLdfaCuxR44lG9WCJZo3d5JlpC4
         z3sv3v1DejFG2z1NRBmg3PIOgJ5y4HSg/rebi1I07nWYSxJeVyqop53b529JYLkx9MBX
         FvkbSu0NSLmquEu1hgoDxIl3FIfHt5fW236QfBKuSRJ5Kqj/lqWyvyXAupNVLz2rPcRv
         d3mGu7Uht0x/CA+vEnGdRkDDQ4k8lseY6W+F1TKt+sNoJ07oRHDDQaSjDkivyp0KDdbv
         zUVQ==
Received: by 10.152.148.40 with SMTP id tp8mr7326725lab.30.1352376552222;
        Thu, 08 Nov 2012 04:09:12 -0800 (PST)
Return-Path: <bardadymc...@gmail.com>
Received: from [192.168.1.4] (broadband-95-106-151-224.atc.tver.ru. [95.106.151.224])
        by mx.google.com with ESMTPS id gk11sm9042410lab.3.2012.11.08.04.09.09
        (version=TLSv1/SSLv3 cipher=OTHER);
        Thu, 08 Nov 2012 04:09:11 -0800 (PST)
Date: Thu, 8 Nov 2012 16:09:08 +0400
From: Denis Bardadym <bardadymc...@gmail.com>
To: liftweb@googlegroups.com
Message-ID: <FB7394766E2C412FA7B5CFC14F3EC...@gmail.com>
In-Reply-To: <91148b39-a5cb-49f3-b2c7-57753acae7a8@googlegroups.com>
References: <422afd6b-c16d-4597-ba11-d049bd93e...@q8g2000yqa.googlegroups.com>
 <cef6ad1c-cee5-4aca-bd0f-769eb3a3c3c5@googlegroups.com>
 <CAE-RkXhBcg65vSvSZd17vRtg=OvLoa_uGfmbfTSadphT_-m...@mail.gmail.com>
 <b910c56c-3263-4658-9c13-4786a6fcab48@googlegroups.com>
 <A9311E6BEFB74DC78300A345525F3...@gmail.com>
 <077d0c8d-9940-47c4-9bf7-ef31be5eeea2@googlegroups.com>
 <5E04051B86DC4FC088AF92F1C8AB5...@gmail.com>
 <91148b39-a5cb-49f3-b2c7-57753acae7a8@googlegroups.com>
Subject: Re: [Lift] Re: OAuth in Lift
X-Mailer: sparrow 1.6.4 (build 1176)
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="509ba0e4_39386575_12d"

--509ba0e4_39386575_12d
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

> Does scala> Auth.authenticate=5Furl(requestToken).to=5Furi.toString res=
ult in my server making a call to a Linked in API=3F
No, it do not make call (all calls are doing with http executors like Htt=
p object or dispatch.nio.http and so on). =20


> If no - where does the uri I am redirecting to come from=3F
This is required by OAuth spec. User should accept all permissions which =
you ask on host site.
-- =20
Denis Bardadym
=D0=9E=D1=82=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=BE =D0=BF=D1=80=
=D0=B8 =D0=BF=D0=BE=D0=BC=D0=BE=D1=89=D0=B8 Sparrow (http://www.sparrowma=
ilapp.com/=3Fsig)


=D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 8 =D0=BD=D0=BE=D1=8F=D0=B1=D1=
=80=D1=8F 2012 =D0=B3. =D0=B2 16:04, bg =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=
=B0=D0=BB:

> =20
> The simplified version of my question is =20
> =20
> =20
> =20
> If yes - why doesn't that show up in dispatch logging like the other ca=
lls=3F
> If no - where does the uri I am redirecting to come from=3F
> =20
> Its just to get my understanding of the process complete, I have got th=
e code to work, so thank you very much for all your input.
> =20
> =20
> =20
> On Thursday, November 8, 2012 11:54:21 AM UTC, Denis Bardadym wrote:
> > Hello. =20
> > =20
> > I post full REPL session there to be more clear about process:
> > =20
> > //needed imports
> > scala> import dispatch.=5F
> > scala> import dispatch.oauth.=5F
> > scala> import dispatch.oauth.OAuth.=5F
> > =20
> > //first it is consumer token =20
> > scala> val consumer =3D Consumer(=22YOU=5FAPP=5FKEY=22, =22YOU=5FAPP=5F=
SECRET=22)
> > //step 1 getting from linked in request token - dispatch call
> > scala> val requestToken =3D Http(Auth.request=5Ftoken(consumer, =22ht=
tp://localhost/callback=22, LinkedInAPI.defaultPermissions))
> > //step 2 obtaining authentication url
> > scala> Auth.authenticate=5Furl(requestToken).to=5Furi.toString
> > res0: java.lang.String =3D https://www.linkedin.com/uas/oauth/authent=
icate=3Foauth=5Ftoken=3DTOKEN
> > =20
> > //there i open browser and go to this url and accept request. Then li=
nked in redirect me to http://localhost/callback (callbackUrl) with 2 uri=
 params: oauth=5Ftoken and oauth=5Fverifier.
> > //so assume it redirect me to such url http://localhost/callback=3Foa=
uth=5Ftoken=3DTOKEN&oauth=5Fverifier=3D73848
> > =20
> > //about implementation there usually user will see popup window with =
this url or full site redirection to this url
> > =20
> > scala> val oauth=5Fverifier=3D =2273848=22
> > oauth=5Fverifier: java.lang.String =3D 73848
> > =20
> > scala> val accessToken =3D Http(Auth.access=5Ftoken(consumer, request=
Token, oauth=5Fverifier))
> > scala> //now i can use this token for authorized calls
> > =20
> > scala> new LinkedInAPI(consumer, accessToken).currentPerson
> > res1: ingo.services.linkedin.LinkedInAPI.Person =3D =20
> > Person(Some(ApiStandardProfileRequest(Headers(1,List(HeaderValue(x-li=
-auth-token,name:TQU=46))))),Some(Date(2,6,1989)),Some(Denis),Some(bardad=
...=40gmail.com (javascript:)),Some(Bardadym),Some(S5wDjU75D5),Some(Compu=
ter Software),Some(design patterns, algorithms, new technology, c++, java=
, smalltalk, js, python, frameworks,...
> > =20
> > =20
> > Hope this will help.
> > =20
> > =20
> > -- =20
> > Denis Bardadym
> > =D0=9E=D1=82=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=BE =D0=BF=D1=
=80=D0=B8 =D0=BF=D0=BE=D0=BC=D0=BE=D1=89=D0=B8 Sparrow (http://www.sparro=
wmailapp.com/=3Fsig)
> > =20
> > =20
> > =D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 8 =D0=BD=D0=BE=D1=8F=D0=B1=
=D1=80=D1=8F 2012 =D0=B3. =D0=B2 15:21, bg =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=
=D0=B0=D0=BB:
> > =20
> > > Hi Denis - thanks for sharing that code, it helped me clean up my i=
mplementation
> > > =20
> > > One thing I'm not clear on still after reading the linked in docs a=
nd looking at the logs is, does obtaining the authenticate=5Furl involve =
a new request to Linked In apis=3F
> > > =20
> > > To try make the question clearer, I can see the below logging from =
dispatch
> > > =20
> > > =5Bconsole logger=5D dispatch: api.linkedin.com (http://api.linkedi=
n.com) POST /uas/oauth/requestToken=3Fscope=3Dr=5Fbasicprofile%2Cr=5Femai=
laddress HTTP/1.1
> > > =5Bconsole logger=5D dispatch: api.linkedin.com (http://api.linkedi=
n.com) POST /uas/oauth/accessToken HTTP/1.1
> > > =20
> > > =20
> > > Debugging the code, requestToken only has value and secret properti=
es - no authenticate=5Furl
> > > =20
> > > So does   val svcAuth =3D :/(=22www.linkedin.com (http://www.linked=
in.com)=22) / =22uas=22 / =22oauth=22 / =22authenticate=22 represent an e=
ndpoint that gets called during authenticate=5Furl=3F If so am I missing =
something in the logs, or does it now get logged=3F
> > > =20
> > > If there isn't an API call, does =22oauth=22 / =22authenticate=22 r=
epresent how to parse the response from requestToken to obtain the authen=
ticate=5Furl=3F And does dispatch store it outside the requestToken so th=
at the requestToken only has the info required for future calls to the AP=
I=3F
> > > =20
> > > Thanks
> > > =20
> > > logs
> > > =20
> > > =5Bconsole logger=5D dispatch: api.linkedin.com (http://api.linkedi=
n.com) POST /uas/oauth/requestToken=3Fscope=3Dr=5Fbasicprofile%2Cr=5Femai=
laddress HTTP/1.1
> > > =5Bconsole logger=5D dispatch: api.linkedin.com (http://api.linkedi=
n.com) POST /uas/oauth/accessToken HTTP/1.1
> > > =5Bconsole logger=5D dispatch: api.linkedin.com (http://api.linkedi=
n.com) GET /v1/people/=7E:(id,first-name,last-name,email-address) HTTP/1.=
1
> > > =20
> > > On Wednesday, November 7, 2012 2:56:41 PM UTC, Denis Bardadym wrote=
:
> > > > Hello.
> > > > =20
> > > > We also doing linkedin oauth integration using dispatch library.
> > > > =20
> > > > =46or linkedin i used such Auth object:
> > > > =20
> > > > object Auth =7B
> > > >   val svc =3D :/(=22api.linkedin.com (http://api.linkedin.com)=22=
) / =22uas=22 / =22oauth=22
> > > >   val svcAuth =3D :/(=22www.linkedin.com (http://www.linkedin.com=
)=22)/=22uas=22/=22oauth=22/=22authenticate=22
> > > > =20
> > > >   def request=5Ftoken(consumer: Consumer, callback=5Furl: String)=
 =3D
> > > >     svc.secure.POST / =22requestToken=22 <=40 (consumer, callback=
=5Furl) as=5Ftoken
> > > > =20
> > > >   def request=5Ftoken(consumer: Consumer, callback=5Furl: String,=
 permissions: List=5BString=5D) =3D
> > > >     svc.secure.POST / =22requestToken=22 <<=3F ((=22scope=22, per=
missions.mkString(=22,=22)) :: Nil) <=40 (consumer, callback=5Furl) as=5F=
token
> > > > =20
> > > >   def authenticate=5Furl(token: Token) =3D
> > > >     svcAuth.secure with=5Ftoken token
> > > > =20
> > > >   def access=5Ftoken(consumer: Consumer, token: Token, verifier: =
String) =3D
> > > >     svc.secure.POST / =22accessToken=22 <=40 (consumer, token, ve=
rifier) >% =7B
> > > >       m =3D> Token(m).get
> > > >     =7D
> > > > =20
> > > >   def access=5Ftoken(consumer: Consumer, token: String) =3D
> > > >     svc.secure.POST / =22accessToken=22 <<=3F ((=22xoauth=5Foauth=
2=5Faccess=5Ftoken=22, token) :: Nil) <=40 (consumer) >% =7B
> > > >       m =3D> Token(m).get
> > > >     =7D
> > > > =7D
> > > > =20
> > > > =20
> > > > Then to login need to do such steps:
> > > > =20
> > > > 1. =46irst request a request token from linkedin. It should be so=
mething like this:
> > > > val requestToken =3D http(Auth.request=5Ftoken(consumer, callback=
Url, LinkedInAPI.defaultPermissions))
> > > > Then save it in session, to check when user goes to callbackUrl.
> > > > 2. Redirect user to authorization url:
> > > > Auth.authenticate=5Furl(requestToken).to=5Furi.toString)
> > > > =20
> > > > Next on callback dispatcher:
> > > > 3. Check that requestToken in session and oauth=5Fverifier param =
in url.
> > > > 4. Ask linked in about access=5Ftoken
> > > > val accessToken =3D http(Auth.access=5Ftoken(consumer, requestTok=
en, oauth=5Fverifier))
> > > > Now save it and use to do linked in calls from this user.
> > > > =20
> > > > All this about dispatch 0.8.8, others not tested.
> > > > =20
> > > > Denis. =20
> > > > =20
> > > > =D1=81=D1=80=D0=B5=D0=B4=D0=B0, 7 =D0=BD=D0=BE=D1=8F=D0=B1=D1=80=D1=
=8F 2012 =D0=B3. =D0=B2 17:51, bg =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=
=BB:
> > > > =20
> > > > > Great thanks for that - using a v8 library resolved it.
> > > > > =20
> > > > > I am trying to work with Linked in OAuth, and would like to use=
 it to log in my user. To do this I would like Linked In to provide an em=
ail address, and based on https://developer.linkedin.com/documents/connec=
tions-api I believe that means I need to make my request include =22scope=
=3Dr=5Fbasicprofile+r=5Femailaddress=22
> > > > > =20
> > > > > Looking at package dispatch.oauth there is a user=5Fparams: Map=
=5BString, Any=5D variable, but I am unsure how to set it. My code curren=
tly looks like
> > > > > =20
> > > > >  def LinkedInOAuth() =3D =7B
> > > > >    //(key: String, secret: String)
> > > > >    val consumer =3D Consumer(=22dfsgdfg=22, =22sdfgsdfgdf=22)
> > > > >    val h =3D new Http
> > > > >    val baseRequest =3D (:/(=22api.linkedin.com (http://api.link=
edin.com)=22) / =22uas=22).secure
> > > > >    val callback =3D =22user=22
> > > > > =20
> > > > >  =20
> > > > > =20
> > > > >    val req=5Ftoken =3D h(baseRequest / =22oauth=22 / =22request=
Token=22 <=40 (consumer,
> > > > >      callback) as=5Ftoken)  <-- think I need to set a custom pa=
rameter in this request to include =22scope=3Dr=5Fbasicprofile+r=5Femaila=
ddress=22
> > > > > =20
> > > > >    //request=5Ftoken(req=5Ftoken)
> > > > >     val authURI =3D (baseRequest / =22oauth=22 / =22authorize=22=
 with=5Ftoken req=5Ftoken).to=5Furi
> > > > >    println(authURI)
> > > > > =20
> > > > >    println(=22Please enter your oauth=5Ftoken code=22)
> > > > >    //val oauth=5Ftoken =3D S.param(=22oauth=5Ftoken=22).getOrEl=
se(=22=22)
> > > > >    val oauth=5Ftoken =3D Console.readLine()
> > > > > =20
> > > > > =20
> > > > > =20
> > > > > Another point is the LinkedIn docs say they are expecting Posts=
, but my console output is telling me I'm doing Gets. Have I got somethin=
g else wrong=3F
> > > > > =20
> > > > > =20
> > > > > On Sunday, November 4, 2012 1:08:13 AM UTC, fmpwizard wrote:
> > > > > > I think that the 0.9 version has a very different api, you ca=
n try a version from 0.8.x
> > > > > > That should work well
> > > > > > Diego
> > > > > > Sent from my android cell =20
> > > > > > On Nov 3, 2012 6:48 PM, =22bg=22 <brent...=40gmail.com> wrote=
:
> > > > > > > Hi,
> > > > > > > =20
> > > > > > > I'm trying to following this example to consume an OAuth se=
rvice, but am getting a compile error  =22not found: value Consumer=22
> > > > > > > =20
> > > > > > > SBT dependency
> > > > > > > =20
> > > > > > > =22net.databinder.dispatch=22 %% =22dispatch-core=22 % =220=
.9.3=22
> > > > > > >  =20
> > > > > > > =20
> > > > > > > code =20
> > > > > > > =20
> > > > > > > =20
> > > > > > > import dispatch.=5F
> > > > > > > import oauth.=5F
> > > > > > > //import OAuth.=5F  <-- this import fails
> > > > > > > =20
> > > > > > > =20
> > > > > > > =20
> > > > > > > class oAuth =7B
> > > > > > >   //val consumer =3D com.ning.http.client.oauth.ConsumerKey=
(apikey, apisecret)
> > > > > > >   val consumer =3D Consumer(=22=5Bseekrit=21=5D=22, =22=5Ba=
lso seekrit=21=5D=22)
> > > > > > >   val h =3D new Http
> > > > > > > =20
> > > > > > > ...
> > > > > > > =20
> > > > > > > I found some reference to the OAuth object http://databinde=
r.net/sxr/dispatch/0.4.2/main/OAuth.scala.html=236764 =20
> > > > > > > =20
> > > > > > > Is it from an older version of dispatch, so an updated way =
to call this is needed=3F Or am I missing an SBT dependancy=3F (or other)=

> > > > > > > On Sunday, January 1, 2012 11:52:00 PM UTC, Rouzbeh wrote:
> > > > > > > > Hello all, =20
> > > > > > > > =20
> > > > > > > > Can somebody direct me to a wiki/doc that would help me g=
et started in =20
> > > > > > > > OAuth and lift - as an starting point(Something like Davi=
d P's chapter =20
> > > > > > > > for OpenID). I see some lift-oauth/mapper archetypes in t=
he repo, but =20
> > > > > > > > have no idea which is which and where to start. =20
> > > > > > > > =20
> > > > > > > > Thanks allot, and happy new year. =20
> > > > > > > > =20
> > > > > > > > Rouzbeh =20
> > > > > > > =20
> > > > > > > -- =20
> > > > > > > -- =20
> > > > > > > Lift, the simply functional web framework: http://liftweb.n=
et
> > > > > > > Code: http://github.com/lift
> > > > > > > Discussion: http://groups.google.com/group/liftweb
> > > > > > > Stuck=3F Help us help you: https://www.assembla.com/wiki/sh=
ow/liftweb/Posting=5Fexample=5Fcode
> > > > > > >  =20
> > > > > > >  =20
> > > > > > >  =20
> > > > > -- =20
> > > > > -- =20
> > > > > Lift, the simply functional web framework: http://liftweb.net
> > > > > Code: http://github.com/lift
> > > > > Discussion: http://groups.google.com/group/liftweb
> > > > > Stuck=3F Help us help you: https://www.assembla.com/wiki/show/l=
iftweb/Posting=5Fexample=5Fcode
> > > > >  =20
> > > > >  =20
> > > > >  =20
> > > > =20
> > > -- =20
> > > -- =20
> > > Lift, the simply functional web framework: http://liftweb.net
> > > Code: http://github.com/lift
> > > Discussion: http://groups.google.com/group/liftweb
> > > Stuck=3F Help us help you: https://www.assembla.com/wiki/show/liftw=
eb/Posting=5Fexample=5Fcode
> > >  =20
> > >  =20
> > >  =20
> > =20
> -- =20
> -- =20
> Lift, the simply functional web framework: http://liftweb.net
> Code: http://github.com/lift
> Discussion: http://groups.google.com/group/liftweb
> Stuck=3F Help us help you: https://www.assembla.com/wiki/show/liftweb/P=
osting=5Fexample=5Fcode
>  =20
>  =20
>  =20


--509ba0e4_39386575_12d
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline


                <div>
                    <blockquote type=3D=22cite=22>Does&nbsp;scala&gt; Aut=
h.authenticate=5Furl(<wbr>requestToken).to=5Furi.toString result in my se=
rver making a call to a Linked in API=3F</blockquote><div>No, it do not m=
ake call (all calls are doing with http executors like Http object or dis=
patch.nio.http and so on).&nbsp;</div>
                </div>
                <div><div><br></div><div><blockquote type=3D=22cite=22>If=
 no - where does the uri I am redirecting to come from=3F</blockquote></d=
iv><div>This is required by OAuth spec. User should accept all permission=
s which you ask on host site.</div><div>--&nbsp;</div><div>Denis Bardadym=
</div><div>=D0=9E=D1=82=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=BE =D0=
=BF=D1=80=D0=B8 =D0=BF=D0=BE=D0=BC=D0=BE=D1=89=D0=B8 <a href=3D=22http://=
www.sparrowmailapp.com/=3Fsig=22>Sparrow</a></div><div><br></div></div>
                =20
                <p style=3D=22color: =23A0A0A8;=22>=D1=87=D0=B5=D1=82=D0=B2=
=D0=B5=D1=80=D0=B3, 8 =D0=BD=D0=BE=D1=8F=D0=B1=D1=80=D1=8F 2012&nbsp;=D0=B3=
. =D0=B2 16:04, bg =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:</p>
                <blockquote type=3D=22cite=22 style=3D=22border-left-styl=
e:solid;border-width:1px;margin-left:0px;padding-left:10px;=22>
                    <span><div><br></div>The simplified version of my que=
stion is&nbsp;<div><br></div><div><br></div><div><br></div><div>If yes - =
why doesn't that show up in dispatch logging like the other calls=3F</div=
><div>If no - where does the uri I am redirecting to come from=3F<br><br>=
Its just to get my understanding of the process complete, I have got the =
code to work, so thank you very much for all your input.</div><div><br></=
div><div><br><br>On Thursday, November 8, 2012 11:54:21 AM UTC, Denis Bar=
dadym wrote:<blockquote type=3D=22cite=22><div>
                <div>
                    Hello.
                </div><div><br></div><div>I post full REPL session there =
to be more clear about process:</div><div><br></div><div>//needed imports=
</div><div><div>scala&gt; import dispatch.=5F</div><div>scala&gt; import =
dispatch.oauth.=5F</div><div>scala&gt; import dispatch.oauth.OAuth.=5F</d=
iv><div><br></div><div>//first it is consumer token&nbsp;</div><div>scala=
&gt; val consumer =3D Consumer(=22YOU=5FAPP=5FKEY=22,&nbsp;=22YOU=5F<wbr>=
APP=5FSECRET=22)</div><div>//step 1 getting from linked in request token =
- dispatch call</div><div>scala&gt; val requestToken =3D Http(Auth.reques=
t=5Ftoken(<wbr>consumer, =22<a href=3D=22http://localhost/callback=22 tar=
get=3D=22=5Fblank=22>http://localhost/callback</a>=22, LinkedInAPI.<wbr>d=
efaultPermissions))</div><div>//step 2 obtaining authentication url</div>=
<div>scala&gt; Auth.authenticate=5Furl(<wbr>requestToken).to=5Furi.toStri=
ng</div><div>res0: java.lang.String =3D <a href=3D=22https://www.linkedin=
.com/uas/oauth/authenticate=3Foauth=5Ftoken=3DTOKEN=22 target=3D=22=5Fbla=
nk=22>https://www.linkedin.com/uas/<wbr>oauth/authenticate=3Foauth=5F<wbr=
>token=3DTOKEN</a></div><div><br></div><div>//there i open browser and go=
 to this url and accept request. Then linked in redirect me to&nbsp;<a hr=
ef=3D=22http://localhost/callback=22 target=3D=22=5Fblank=22>http://local=
host/callback</a> (callbackUrl) with 2 uri params: oauth=5Ftoken and oaut=
h=5Fverifier.</div><div>//so assume it redirect me to such url&nbsp;<a hr=
ef=3D=22http://localhost/callback=3Foauth=5Ftoken=3DTOKEN&amp;oauth=5Fver=
ifier=3D73848=22 target=3D=22=5Fblank=22>http://localhost/callback=3F<wbr=
>oauth=5Ftoken=3DTOKEN&amp;oauth=5F<wbr>verifier=3D73848</a></div><div><b=
r></div><div>//about implementation there usually user will see popup win=
dow with this url or full site redirection to this url</div><div><br></di=
v><div>scala&gt; val oauth=5Fverifier=3D =2273848=22</div><div>oauth=5Fve=
rifier: java.lang.String =3D 73848</div><div><br></div><div>scala&gt; val=
 accessToken =3D Http(Auth.access=5Ftoken(<wbr>consumer, requestToken, oa=
uth=5Fverifier))</div><div>scala&gt; //now i can use this token for autho=
rized calls</div></div><div>scala&gt; new LinkedInAPI(consumer, accessTok=
en).currentPerson</div><div><div>res1: ingo.services.linkedin.<wbr>Linked=
InAPI.Person =3D&nbsp;</div><div>Person(Some(<wbr>ApiStandardProfileReque=
st(<wbr>Headers(1,List(HeaderValue(x-<wbr>li-auth-token,name:TQU=46))))),=
<wbr>Some(Date(2,6,1989)),Some(<wbr>Denis),Some(<a href=3D=22javascript:=22=
 target=3D=22=5Fblank=22 gdf-obfuscated-mailto=3D=22Q2KSGB8qMLgJ=22>barda=
d...=40<wbr>gmail.com</a>),Some(Bardadym),<wbr>Some(S5wDjU75D5),Some(Comp=
uter Software),Some(design patterns, algorithms, new technology, c++, jav=
a, smalltalk, js, python, frameworks,...</div></div><div><br></div><div>H=
ope this will help.</div><div><br></div>
                <div><div><br></div><div>--&nbsp;</div><div>Denis Bardady=
m</div><div>=D0=9E=D1=82=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=BE =
=D0=BF=D1=80=D0=B8 =D0=BF=D0=BE=D0=BC=D0=BE=D1=89=D0=B8 <a href=3D=22http=
://www.sparrowmailapp.com/=3Fsig=22 target=3D=22=5Fblank=22>Sparrow</a></=
div><div><br></div></div>
                 =20
                <p style=3D=22color:=23a0a0a8=22>=D1=87=D0=B5=D1=82=D0=B2=
=D0=B5=D1=80=D0=B3, 8 =D0=BD=D0=BE=D1=8F=D0=B1=D1=80=D1=8F 2012&nbsp;=D0=B3=
. =D0=B2 15:21, bg =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:</p><blockq=
uote type=3D=22cite=22><div>
                    <span><div><div>Hi Denis - thanks for sharing that co=
de, it helped me clean up my implementation<div><br></div><div>One thing =
I'm not clear on still after reading the linked in docs and looking at th=
e logs is, does obtaining the&nbsp;authenticate=5Furl involve a new reque=
st to Linked In apis=3F</div><div><br></div><div>To try make the question=
 clearer, I can see the below logging from dispatch</div><div><br></div><=
div>=5Bconsole logger=5D dispatch: <a href=3D=22http://api.linkedin.com=22=
 target=3D=22=5Fblank=22>api.linkedin.com</a> POST /uas/oauth/requestToke=
n=3Fscope=3D<wbr>r=5Fbasicprofile%2Cr=5F<wbr>emailaddress HTTP/1.1<br></d=
iv><div>=5Bconsole logger=5D dispatch: <a href=3D=22http://api.linkedin.c=
om=22 target=3D=22=5Fblank=22>api.linkedin.com</a> POST /uas/oauth/access=
Token HTTP/1.1<br></div><div><br></div><div><br></div><div>Debugging the =
code, requestToken only has value and secret properties - no authenticate=
=5Furl</div><div><br></div><div>So does&nbsp;&nbsp; val svcAuth =3D :/(=22=
<a href=3D=22http://www.linkedin.com=22 target=3D=22=5Fblank=22>www.linke=
din.com</a>=22) / =22uas=22 / =22oauth=22 / =22authenticate=22 represent =
an endpoint that gets called during&nbsp;authenticate=5Furl=3F If so am I=
 missing something in the logs, or does it now get logged=3F</div><div><b=
r></div><div>If there isn't an API call, does&nbsp;=22oauth=22 / =22authe=
nticate=22 represent how to parse the response from&nbsp;requestToken to =
obtain the&nbsp;authenticate=5Furl=3F And&nbsp;does dispatch store it out=
side the requestToken so that the requestToken only has the info required=
 for&nbsp;future&nbsp;calls to the API=3F</div><div><br></div><div>Thanks=
</div><div><br></div><div>logs</div><div><br></div><div>=5Bconsole logger=
=5D dispatch: <a href=3D=22http://api.linkedin.com=22 target=3D=22=5Fblan=
k=22>api.linkedin.com</a> POST /uas/oauth/requestToken=3Fscope=3D<wbr>r=5F=
basicprofile%2Cr=5F<wbr>emailaddress HTTP/1.1<br></div><div>=5Bconsole lo=
gger=5D dispatch: <a href=3D=22http://api.linkedin.com=22 target=3D=22=5F=
blank=22>api.linkedin.com</a> POST /uas/oauth/accessToken HTTP/1.1<br></d=
iv><div>=5Bconsole logger=5D dispatch: <a href=3D=22http://api.linkedin.c=
om=22 target=3D=22=5Fblank=22>api.linkedin.com</a> GET /v1/people/=7E:(id=
,first-name,<wbr>last-name,email-address) HTTP/1.1<br></div><div><br>On W=
ednesday, November 7, 2012 2:56:41 PM UTC, Denis Bardadym wrote:<blockquo=
te type=3D=22cite=22><div>
                <div>Hello.</div><div><br></div><div>We also doing linked=
in oauth integration using dispatch library.</div><div><br></div><div>=46=
or linkedin i used such Auth object:</div><div><br></div><div><div>object=
 Auth =7B</div><div>&nbsp; val svc =3D :/(=22<a href=3D=22http://api.link=
edin.com=22 target=3D=22=5Fblank=22>api.linkedin.com</a>=22) / =22uas=22 =
/ =22oauth=22</div><div>&nbsp; val svcAuth =3D :/(=22<a href=3D=22http://=
www.linkedin.com=22 target=3D=22=5Fblank=22>www.linkedin.com</a>=22)/=22u=
as=22/=22<wbr>oauth=22/=22authenticate=22</div><div><br></div><div>&nbsp;=
 def request=5Ftoken(consumer: Consumer, callback=5Furl: String) =3D</div=
><div>&nbsp; &nbsp; svc.secure.POST / =22requestToken=22 &lt;=40 (consume=
r, callback=5Furl) as=5Ftoken</div><div><br></div><div>&nbsp; def request=
=5Ftoken(consumer: Consumer, callback=5Furl: String, permissions: List=5B=
String=5D) =3D</div><div>&nbsp; &nbsp; svc.secure.POST / =22requestToken=22=
 &lt;&lt;=3F ((=22scope=22, permissions.mkString(=22,=22)) :: Nil) &lt;=40=
 (consumer, callback=5Furl) as=5Ftoken</div><div><br></div><div>&nbsp; de=
f authenticate=5Furl(token: Token) =3D</div><div>&nbsp; &nbsp; svcAuth.se=
cure with=5Ftoken token</div><div><br></div><div>&nbsp; def access=5Ftoke=
n(consumer: Consumer, token: Token, verifier: String) =3D</div><div>&nbsp=
; &nbsp; svc.secure.POST / =22accessToken=22 &lt;=40 (consumer, token, ve=
rifier) &gt;% =7B</div><div>&nbsp; &nbsp; &nbsp; m =3D&gt; Token(m).get</=
div><div>&nbsp; &nbsp; =7D</div><div><br></div><div>&nbsp; def access=5Ft=
oken(consumer: Consumer, token: String) =3D</div><div>&nbsp; &nbsp; svc.s=
ecure.POST / =22accessToken=22 &lt;&lt;=3F ((=22xoauth=5Foauth2=5Faccess=5F=
token=22<wbr>, token) :: Nil) &lt;=40 (consumer) &gt;% =7B</div><div>&nbs=
p; &nbsp; &nbsp; m =3D&gt; Token(m).get</div><div>&nbsp; &nbsp; =7D</div>=
<div>=7D</div></div><div><br></div><div>Then to login need to do such ste=
ps:</div><div><br></div><div>1. =46irst request a request token from link=
edin. It should be something like this:</div><div>val requestToken =3D ht=
tp(Auth.request=5Ftoken(<wbr>consumer, callbackUrl, LinkedInAPI.<wbr>defa=
ultPermissions))</div><div>Then save it in session, to check when user go=
es to callbackUrl.</div><div>2. Redirect user to authorization url:</div>=
<div>Auth.authenticate=5Furl(<wbr>requestToken).to=5Furi.toString)</div><=
div><br></div><div>Next on callback dispatcher:</div><div>3. Check that r=
equestToken in session and&nbsp;oauth=5Fverifier param in url.</div><div>=
4. Ask linked in about access=5Ftoken</div><div>val accessToken =3D http(=
Auth.access=5Ftoken(<wbr>consumer, requestToken, oauth=5Fverifier))</div>=
<div>Now save it and use to do linked in calls from this user.</div><div>=
<br></div><div>All this about dispatch 0.8.8, others not tested.</div><di=
v><br></div><div>Denis.</div>
                  =20
                <p style=3D=22color:=23a0a0a8=22>=D1=81=D1=80=D0=B5=D0=B4=
=D0=B0, 7 =D0=BD=D0=BE=D1=8F=D0=B1=D1=80=D1=8F 2012&nbsp;=D0=B3. =D0=B2 1=
7:51, bg =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:</p><blockquote type=3D=
=22cite=22><div>
                    <span><div><div>Great thanks for that - using a v8 li=
brary resolved it.<div><br></div><div>I am trying to work with Linked in =
OAuth, and would like to use it to log in my user. To do this I would lik=
e Linked In to provide an email address, and based on&nbsp;<a href=3D=22h=
ttps://developer.linkedin.com/documents/connections-api=22 target=3D=22=5F=
blank=22>https://developer.linkedin.<wbr>com/documents/connections-api</a=
>&nbsp;<wbr>I believe that means I need to make my request include =22sco=
pe=3Dr=5Fbasicprofile+r=5F<wbr>emailaddress=22</div><div><br></div><div>L=
ooking at&nbsp;package dispatch.oauth there is a&nbsp;user=5Fparams: Map=5B=
String, Any=5D variable, but I am unsure how to set it. My code currently=
 looks like</div><div><br></div><div><div>&nbsp;def LinkedInOAuth() =3D =7B=
</div><div>&nbsp; &nbsp;//(key: String, secret: String)</div><div>&nbsp; =
&nbsp;val consumer =3D Consumer(=22dfsgdfg=22, =22sdfgsdfgdf=22)</div><di=
v>&nbsp; &nbsp;val h =3D new Http</div><div>&nbsp; &nbsp;val baseRequest =
=3D (:/(=22<a href=3D=22http://api.linkedin.com=22 target=3D=22=5Fblank=22=
>api.linkedin.com</a>=22) / =22uas=22).secure</div><div>&nbsp; &nbsp;val =
callback =3D =22user=22</div><div><br></div><div>&nbsp;</div><div><br></d=
iv><div>&nbsp; &nbsp;val req=5Ftoken =3D h(baseRequest / =22oauth=22 / =22=
requestToken=22 &lt;=40 (consumer,</div><div>&nbsp; &nbsp; &nbsp;callback=
) as=5Ftoken) &nbsp;&lt;-- think I need to set a custom parameter in this=
 request to include =22scope=3Dr=5Fbasicprofile+r=5F<wbr>emailaddress=22<=
/div><div><br></div><div>&nbsp; &nbsp;//request=5Ftoken(req=5Ftoken)</div=
><div>&nbsp; &nbsp; val authURI =3D (baseRequest / =22oauth=22 / =22autho=
rize=22 with=5Ftoken req=5Ftoken).to=5Furi</div><div>&nbsp; &nbsp;println=
(authURI)</div><div><br></div><div>&nbsp; &nbsp;println(=22Please enter y=
our oauth=5Ftoken code=22)</div><div>&nbsp; &nbsp;//val oauth=5Ftoken =3D=
 S.param(=22oauth=5Ftoken=22).<wbr>getOrElse(=22=22)</div><div>&nbsp; &nb=
sp;val oauth=5Ftoken =3D Console.readLine()</div><div><br></div><div><br>=
</div><div><br></div>Another point is the LinkedIn docs say they are expe=
cting Posts, but my console output is telling me I'm doing Gets. Have I g=
ot something else wrong=3F</div><div><br></div><div><br>On Sunday, Novemb=
er 4, 2012 1:08:13 AM UTC, fmpwizard wrote:<blockquote type=3D=22cite=22>=
<div><p>I think that the 0.9 version has a very different api, you can tr=
y a version from 0.8.x</p>
<p>That should work well</p>
<p>Diego<br>
Sent from my android cell</p>
<div>On Nov 3, 2012 6:48 PM, =22bg=22 &lt;<a>brent...=40gmail.com</a>&gt;=
 wrote:<br type=3D=22attribution=22><blockquote type=3D=22cite=22><div>
Hi,<div><br></div><div>I'm trying to following this example to consume an=
 OAuth service, but am getting a compile error &nbsp;=22not found: value =
Consumer=22</div><div><br></div><div>SBT&nbsp;dependency</div><div><br></=
div>
<div>=22net.databinder.dispatch=22 %% =22dispatch-core=22 % =220.9.3=22</=
div><div>&nbsp;</div><div><br></div><div>code&nbsp;</div><div><div><br><b=
r></div><div><div>import dispatch.=5F</div><div>import oauth.=5F</div><di=
v>
//import OAuth.=5F &nbsp;&lt;-- this import fails</div></div></div><div><=
br></div><div><div>class oAuth =7B</div><div>&nbsp; //val consumer =3D co=
m.ning.http.client.oauth.<wbr>ConsumerKey(apikey, apisecret)</div><div>&n=
bsp; val consumer =3D Consumer(=22=5Bseekrit=21=5D=22, =22=5Balso seekrit=
=21=5D=22)</div>
<div>&nbsp; val h =3D new Http</div><div><br></div><div>...</div><div><br=
></div><div>I found some reference to the OAuth object&nbsp;<a href=3D=22=
http://databinder.net/sxr/dispatch/0.4.2/main/OAuth.scala.html=236764=22 =
target=3D=22=5Fblank=22>http://databinder.net/<wbr>sxr/dispatch/0.4.2/mai=
n/OAuth.<wbr>scala.html=236764</a></div>
<div><br></div><div>Is it from an older version of dispatch, so an update=
d way to call this is needed=3F Or am I missing an SBT dependancy=3F (or =
other)</div><br>On Sunday, January 1, 2012 11:52:00 PM UTC, Rouzbeh wrote=
:<blockquote type=3D=22cite=22><div>
Hello all,
<br>
<br>Can somebody direct me to a wiki/doc that would help me get started i=
n
<br>OAuth and lift - as an starting point(Something like David P's chapte=
r
<br>for OpenID). I see some lift-oauth/mapper archetypes in the repo, but=

<br>have no idea which is which and where to start.
<br>
<br>Thanks allot, and happy new year.
<br>
<br>Rouzbeh</div></blockquote></div>

<p></p>

-- <br>
-- <br>
Lift, the simply functional web framework: <a href=3D=22http://liftweb.ne=
t=22 target=3D=22=5Fblank=22>http://liftweb.net</a><br>
Code: <a href=3D=22http://github.com/lift=22 target=3D=22=5Fblank=22>http=
://github.com/lift</a><br>
Discussion: <a href=3D=22http://groups.google.com/group/liftweb=22 target=
=3D=22=5Fblank=22>http://groups.google.com/<wbr>group/liftweb</a><br>
Stuck=3F Help us help you: <a href=3D=22https://www.assembla.com/wiki/sho=
w/liftweb/Posting=5Fexample=5Fcode=22 target=3D=22=5Fblank=22>https://www=
.assembla.com/wiki/<wbr>show/liftweb/Posting=5Fexample=5F<wbr>code</a><br=
>
&nbsp;<br>
&nbsp;<br>
&nbsp;<br>
</div></blockquote></div>
</div></blockquote></div>

<p></p>

-- <br>
-- <br>
Lift, the simply functional web framework: <a href=3D=22http://liftweb.ne=
t=22 target=3D=22=5Fblank=22>http://liftweb.net</a><br>
Code: <a href=3D=22http://github.com/lift=22 target=3D=22=5Fblank=22>http=
://github.com/lift</a><br>
Discussion: <a href=3D=22http://groups.google.com/group/liftweb=22 target=
=3D=22=5Fblank=22>http://groups.google.com/<wbr>group/liftweb</a><br>
Stuck=3F Help us help you: <a href=3D=22https://www.assembla.com/wiki/sho=
w/liftweb/Posting=5Fexample=5Fcode=22 target=3D=22=5Fblank=22>https://www=
.assembla.com/wiki/<wbr>show/liftweb/Posting=5Fexample=5F<wbr>code</a><br=
>
&nbsp;<br>
&nbsp;<br>
&nbsp;<br>
</div></div></span>
                  =20
                  =20
                  =20
                  =20
                </div></blockquote><div>
                    <br>
                </div>
</div></blockquote></div>

<p></p>

-- <br>
-- <br>
Lift, the simply functional web framework: <a href=3D=22http://liftweb.ne=
t=22 target=3D=22=5Fblank=22>http://liftweb.net</a><br>
Code: <a href=3D=22http://github.com/lift=22 target=3D=22=5Fblank=22>http=
://github.com/lift</a><br>
Discussion: <a href=3D=22http://groups.google.com/group/liftweb=22 target=
=3D=22=5Fblank=22>http://groups.google.com/<wbr>group/liftweb</a><br>
Stuck=3F Help us help you: <a href=3D=22https://www.assembla.com/wiki/sho=
w/liftweb/Posting=5Fexample=5Fcode=22 target=3D=22=5Fblank=22>https://www=
.assembla.com/wiki/<wbr>show/liftweb/Posting=5Fexample=5F<wbr>code</a><br=
>
&nbsp;<br>
&nbsp;<br>
&nbsp;<br>
</div></div></span>
                 =20
                 =20
                 =20
                 =20
                </div></blockquote><div>
                    <br>
                </div>
</div></blockquote></div>

<p></p>

-- <br>
-- <br>
Lift, the simply functional web framework: <a href=3D=22http://liftweb.ne=
t=22>http://liftweb.net</a><br>
Code: <a href=3D=22http://github.com/lift=22>http://github.com/lift</a><b=
r>
Discussion: <a href=3D=22http://groups.google.com/group/liftweb=22>http:/=
/groups.google.com/group/liftweb</a><br>
Stuck=3F Help us help you: <a href=3D=22https://www.assembla.com/wiki/sho=
w/liftweb/Posting=5Fexample=5Fcode=22>https://www.assembla.com/wiki/show/=
liftweb/Posting=5Fexample=5Fcode</a><br>
&nbsp;<br>
&nbsp;<br>
&nbsp;<br>
</span>
                =20
                =20
                =20
                =20
                </blockquote>
                =20
                <div>
                    <br>
                </div>
            
--509ba0e4_39386575_12d--