Am Montag, 2. Januar 2012, um 00:52:00 schrieb Rouzbeh:
> Can somebody direct me to a wiki/doc that would help me get started in
> OAuth and lift - as an starting point(Something like David P's chapter
> for OpenID).
Do you want to use OAuth to, e.g. authenticate your user with a 3rd party
service, or do you want to *provide* OAuth services yourself?
Tobias
I'd love to learn how to provide the services, but I think the oauth module provided as a part of lift is a client.
On the client side, i'm struggling to understand what id_token is and whether it can be used as a primary key of some sort.
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
Am Montag, 2. Januar 2012, 14:30:35 schrieb Rouzbeh:
> I want to be a consumer of an OAuth provider (yammer), and want to
> create a client app. I have read different blogs and random mail
> threads and apparently the best choice is using dispatch ( if I want
> to use only scala) ....
>
> Now apparently there is a Lift client .... but cant find a wiki or
> doc
From what I understand, this is a OAuth provider implementation (e.g. to
provide an OAuth-authenticated API), not a client (correct me if I'm wrong).
I've been using dispatch <http://dispatch.databinder.net/Dispatch.html> to
authenticate against an OAuth-enabled authentication provider like this:
1. My User model object overrides loginMenuLocParams with an EarlyResponse
LocParam that first gets a request token like
val consumer = Consumer(apikey, apisecret)
val h = new Http
val baseRequest = (:/(host, Integer.valueOf(port)))
val callback = "http://myhost.com/oauth_verify/"
val req_token = h(baseRequest / "oauth" / "request_token" <@(consumer,
callback) as_token)
then stores the request token in a SessionVar and redirects:
request_token(req_token)
val authURI = (baseRequest / "oauth" / "authorize" with_token
request_token).to_uri
Full(RedirectResponse(authURI.toString))
2. To handle visits to /oauth_verify, I added a custom dispatch function
LiftRules.dispatch.append{
case Req(List("oauth_verify", _), _, _) =>
() => User.storeOAuthInfo()
}
and in User.storeOAuthInfo(), I basically do the following:
val oauth_token = S.param("oauth_token").getOrElse("")
val oauth_verifier = S.param("oauth_verifier").getOrElse("")
// get the access token for that user:
val access_token = h(baseRequest / "oauth" / "access_token" <@
(consumer, request_token, oauth_verifier) as_token)
3. Then of course, you need some way to match your local user entry with
that remotely authenticated user, e.g. an email address, and somehow store
the OAuth tokens for that user.
4. An API call is then done like this:
val access_token = new Token(User.currentUser.get.access_token_value,
User.currentUser.get.access_token_secret)
val req = restRequest <<? Map("method" -> "method.name",
"param" -> "42",
"format" -> "xml") <@ (consumer,
access_token,
User.currentUser.get.verification_code)
Hope this helps,
Tobias
I think that the 0.9 version has a very different api, you can try a version from 0.8.x
That should work well
Diego
Sent from my android cell
--
среда, 7 ноября 2012 г. в 17:51, bg написал:
четверг, 8 ноября 2012 г. в 15:21, bg написал:
Does scala> Auth.authenticate_url(requestToken).to_uri.toString result in my server making a call to a Linked in API?
If no - where does the uri I am redirecting to come from?
четверг, 8 ноября 2012 г. в 16:04, bg написал:
The simplified version of my question is
OK, thanks for clarifying that for me, I'm pretty comfortable with the end to end process now.