UserAgentClient and OAuth 2 implicit grant supported?

304 views
Skip to first unread message

Sprinkle

unread,
May 23, 2012, 5:35:50 PM5/23/12
to DotNetOpenAuth
Hi,

Trying to test out OAuth 2 and implicit grant type in a desktop app.

I'm looking at using the UserAgentClient class in DNOA 4, am I looking
at the right class for the job?

I can't seem to find how to tell the UserAgentClient that I am
requesting an implicit grant, is this feature baked in that class
yet? It keep going to the the "Token Endpoint" and the spec say for
implicit grant type it shouldn't goto the Token Endpoint? (http://
tools.ietf.org/html/draft-ietf-oauth-v2-26#section-3.2)

Am I on the right track to look at implementing a client call with
implicit grant? Pointers appreciated.



Thanks,

Eddie

Sprinkle

unread,
May 24, 2012, 11:12:36 PM5/24/12
to DotNetOpenAuth

Ok I have been reading the library source code and this works, for
anyone else that might be interested.


var authorizationState = new AuthorizationState();
authorizationState.ClientIdentifier = "YOUR_CLIENT_ID";
var uri = userAgentClient.RequestUserAuthorization(authorizationState,
true);


// Then have to use whatever method on your client, most likely an
embedded browser to request the "uri" from above.
// Then the auth server will give you a final redirect url.

// The finalUri will not work if it has a #. Ie
http://localhost/#token_type=bearer&access_token=...., have to replace
the # with ? for the ProcessUserAuthorization method work.

if (userAgentClient.ProcessUserAuthorization(finalUri,
authorizationState) != null)
{
// Success
}

Andrew Arnott

unread,
May 25, 2012, 1:11:02 AM5/25/12
to dotnet...@googlegroups.com
That's about right, except I don't think authorizationState has a ClientIdentifier property -- you should set that on your UserAgentClient instance.

--
Andrew Arnott
"I [may] not agree with what you have to say, but I'll defend to the death your right to say it." - S. G. Tallentyre


}

--
You received this message because you are subscribed to the Google Groups "DotNetOpenAuth" group.
To post to this group, send email to dotnet...@googlegroups.com.
To unsubscribe from this group, send email to dotnetopenid...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/dotnetopenid?hl=en.


Reply all
Reply to author
Forward
0 new messages