c# - DotNetOpenAuth OAuth2 for Basecamp API -
i'm having difficulties getting oauth2 working basecamp api dotnetopenauth, here's have far, asp.net mvc 4 web app.
public actionresult basecamp() { var server = new dotnetopenauth.oauth2.authorizationserverdescription(); server.authorizationendpoint = new uri("https://launchpad.37signals.com/authorization/new"); server.tokenendpoint = new uri("https://launchpad.37signals.com/authorization/token"); var client = new dotnetopenauth.oauth2.webserverclient( server, "my-basecamp-id", "my-basecamp-secret"); client.requestuserauthorization(returnto: new uri("http://localhost:55321/settings/basecampauth")); response.end(); return null; } [httppost] public actionresult basecampauth() { var server = new dotnetopenauth.oauth2.authorizationserverdescription(); server.authorizationendpoint = new uri("https://launchpad.37signals.com/authorization/new"); server.tokenendpoint = new uri("https://launchpad.37signals.com/authorization/token"); var client = new dotnetopenauth.oauth2.webserverclient( server, "my-basecamp-id", "my-basecamp-secret"); var state = client.processuserauthorization(request); response.write(state.accesstoken); response.end(); return null; }
the error basecamp:
--- :error: "unsupported type: nil. support user_agent , web_server."
i've tried search , around, , not found interesting. / pointer appreciated.
thanks
change this:
server.authorizationendpoint = new uri("https://launchpad.37signals.com/authorization/new");
to this:
server.authorizationendpoint = new uri("https://launchpad.37signals.com/authorization/new?type=web_server");
note: added type=web_server
end of uri.
take these official docs.
Comments
Post a Comment