Forum Discussion
Hi TariqHussain,
Thanks again for your help! :) I've tried adding the https:// to the redirect URI as you noted above. Now I am no longer receiving an error after passing the initial GET request which returns with code in my URL, however, I am still receiving a 500 error (via HttpRequester on Firefox) or "Unexpected Error" (via Chrome using Postman after prompting my login credentials) after the POST request. Any ideas? Here are my new steps to recreate:
1) Sign in with credentials to https://forums.stage.[mycommunity].com
1) Pass GET request via URL https://forums.stage.[mycommunity].com/auth/oauth2/authorize?client_id=[exactly_as_shown_in_Apps_API]&response_type=code&redirect_uri=https://forums.stage.[mycommunity].com
2) No longer see an error page and am returned to the base stage page with the URL https://forums.stage.[mycommunity].com/?code=[encoded_code]&user-id=125&tenant-id=[mytenantid]&proxy-host=api.stage.lithium.com
3) Pass a POST request via HttpRequester using:
URL: https://api.stage.lithium.com/auth/v1/accessToken
Header:
client_secret: [exactly_as_shown_in_API_Web_Apps]
client_id: [exactly_as_shown_in_API_Web_Apps]
code: [encoded_code_from_URL_in_step_2] <- also tried decoded but didn't seem to make a difference
content-type: "application/json"
grant_type: "authorization_code"
Results:
{"status":"Internal Server Error","message":"Internal Server Error","statusCode":500}
Any ideas? I am sure I am just doing something simple wrong, but can't seem to figure it out.
Thanks again!
Kate
khill- You are passing all the parameters as header. However, as mentioned in a doc here, You should pass the client id in header, and all other parameters along with client-id as request body.
Example Code below
LJdishd:~ joan.doe$ curl -X POST -H "Content-Type: application/json" -H "client-id: Fblkh30GinF48502kEsk4FmGslkjdfjasdj=" -d '{"client_id" :"Fblkh30GinF48502kEsk4FmGslkjdfjasdj=", "client_secret" :"FKDDASDK309slkdfaDkdlkjie92=","grant_type" : "authorization_code", "redirect_uri" :"http://redirect.example_community.com/getaccessToken", "code":"i7liaoFaOjG6yDKN4tQYXrhewKog3k4ryYGWLS6hbrI="}' "https://api.lithium.com/auth/v1/accessToken"
- khill8 years agoMentor
Thanks Tariq so much for your help! I was definitely not passing those parameters in the right place.
Unfortunately, after that adjustment I am still receiving the 505 server error so I must be doing something else wrong. Sent in a service request to Lithium in hopes they can help me troubleshoot with my actual community keys and URLs. Unless, of course, you have any other ideas :)
Thank you again for your help!!