• Post Reply Bookmark Topic Watch Topic
  • New Topic

Cannot Access Token in OAuth2.0 using JAVA  RSS feed

 
Durga Roobini
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • 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


 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!