java - How to get the code and state from the callback URL of oauth in linkedin authetication -


i trying access linkedin api servlet, using oauth service.i able login application linkedin account.like posting screen shot.enter image description here

this working fine .but problem not able value call url.i.e

protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception {       /*string callbackurl = request.getrequesturl().tostring();     httpsession mysession = request.getsession();     */     string authurl = "https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=787mznyz5nn2nl&redirect_uri=http%3a%2f%2flocalhost:8080%2fconnectsocialmedia%2f&state=dceefwf45a53sdfkef424";      //system.out.println("1st url: "+authurl);       response.sendredirect(authurl);     string query = request.getquerystring();     system.out.println("query -->"+query); 

can me code , state after allow access button??

the oauth dance works following:

  1. user attempts authentication site/app
  2. your app/site redirects user oauth service provider(linkedin), therby passing on parameter redirect url
  3. user authenticates oauth service provider , grants privileges site/app
  4. the auth service provider redirects user url provided in step 2
  5. your site/app must handle redirected request , extract oauth token

you need implement 2 handlers - 1 redirecting linkedin redirect url provided , second accepting redirect , extracting token. description , code surmise have implemented half of first handler.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -