Forum Discussion

khill's avatar
khill
Mentor
7 years ago

API Newbie - OAuth 2.0 "Internal Server Error" StatusCode 500

Hi everyone,

 

First - I am a brand new API user and doing my best to learn as much as possible, but am getting stuck.  I've been trying to follow the great suggestions made on this thread but seem to keep hitting errors.  I think I am running into the issue during the OAuth2.0 process, but have provided all my steps just in case I am doing something wrong before this step.  Any help/advice you can give a non-programmer data analyst like me would be SO appreciated!!

 

Thank you in advance!

Kate

---

 

End Goal: To perform a regular XML or JSON export of our forums data from the messages, user, and several associated tables to be incorporated into an on-premise business intelligence solution to allow by topic focused reporting.

 

Steps Taken so Far:

1) Determined fields needed and data type availability etc. via APIv2 documentation 


2) Gained access to our site's stage environment to test LiQL queries via the Studio>API Browser tab.  Created a successful test query (example - SELECT * FROM messages WHERE id = "17478")


3) Gained access to stage environment Admin to navigate to API Apps and create a new web app where display name= Test, Authorization Redirect URL = forums.stage.[ourcommunity].com


4) Via new Web API App, noted Tenant ID, Client ID and Client Secret


5) Try an unauthenticated test call via Postman using https://api.stage.lithium.com/community/2.0/[tennantID]/search?q=SELECT+*+FROM+messages+WHERE+id%3D"17478"&api.pretty_print=true 


6) Received error message 401 "Invalid Access Token. Please refresh the token" 


5) Try to complete OAuth2.0 to get a valid access Token:

 

a) Submit URL https://forums.stage.[ourcommunity].com/auth/oauth2/authorize?/clientid=[exact_client_id_shown_in_Web_API_App]&response_type&redirect_uri=forums.stage.[ourcommunity].com

b) Receive a "The page you are trying to access was not found.  Please check your URL for typos and try again" in browser with following URL https://forums.stage.[mycommunity].com/t5/oauth/forums.stage.[mycommunity].com?code=[encoded_string]&user-id=125&tenant-id=[my_tenant_id]&proxy-host=api.stage.lithium.com

c) Using HTTPRequester in my Firefox browser (couldn't get the flow this far w/ Postman) pass a POST request for https://api.stage.lithium.com/auth/v1/accessToken with the following in header:

client_id: [exactly as found on my API Web Apps]

content-type: "application/json"

client_secret: [exactly as found on my API Web Apps]

code: [exactly as found in URL in step b]

Redirect_uri: "forums.stage.[mycommunity].com

grant_type: authorization_code

 

And here is where I keep getting stuck....

Result:

{"status":"Internal Server Error","message":"Internal Server Error","statusCode":500}

 

Any ideas?