• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Cannot Access Token in OAuth2.0 using JAVA

 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
am trying for oauth2 authentication for imgur Api in java,i am getting the code from redirect URI but i cannot get the access token from the line


i have to send clientid,clientsecret,granttype,code to access token url by using POST method i tried but i got error like

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.scribe.exceptions.OAuthException: Cannot extract an acces token. Response was: {"data":{"error":"Missing required fields","request":"\/oauth2\/token","method":"GET"},"success":false,"status":400}
org.scribe.extractors.JsonTokenExtractor.extract(JsonTokenExtractor.java:24)
org.scribe.oauth.OAuth20ServiceImpl.getAccessToken(OAuth20ServiceImpl.java:37)
com.durga.ImgurCallbackServlet.doGet(ImgurCallbackServlet.java:54)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.16 logs.


--------------------------------------------------------------------------------

Apache Tomcat/6.0.16


here is my coding that what i tried is


 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Durga Roobini wrote:i have to send clientid,clientsecret,granttype,code to access token url by using POST method i tried but i got error like


Not being an OAuth expert, I honestly have no idea what you're problem is. However, there seems to be a lot of information in that error message after the "Response was:" bit, so I'd check the documentation (or Google) to see what it actually means. Clearly, it would appear that you're not providing information that the method needs though.

Also (but unrelated), I find it surprising that you're providing things like "api secret" and "client secret" as open text, because it would suggest to me that it could be easily cracked; but, as I say, I'm no OAuth expert.

Winston

PS: Your lines are far too long.
 
Durga Roobini
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Winston Gutkowski wrote:

Durga Roobini wrote:i have to send clientid,clientsecret,granttype,code to access token url by using POST method i tried but i got error like


Not being an OAuth expert, I honestly have no idea what you're problem is. However, there seems to be a lot of information in that error message after the "Response was:" bit, so I'd check the documentation (or Google) to see what it actually means. Clearly, it would appear that you're not providing information that the method needs though.

Also (but unrelated), I find it surprising that you're providing things like "api secret" and "client secret" as open text, because it would suggest to me that it could be easily cracked; but, as I say, I'm no OAuth expert.

Winston

PS: Your lines are far too long.



Hi Winston,That keys are duplicate more than i neve miss any methods i gothrough the documentation after that only i start doing,if am use some other provider instead imgur,it keeps same problem,becuse am sending parameters by post method using http client,so am i struck here only please some one help to get rid of this problem
 
Listen. That's my theme music. That's how I know I'm a super hero. That, and this tiny ad told me:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic