Get a key,from here
https://developer.ibm.com/api/view/id-160:title-Watson_Analytics
Go to the manage api section and get these two parameters.
X-IBM-Client-Id c1a4d636-51c1-4aad-
X-IBM-Client-Secret gC3pL3sG2eC0cK4kB3mK
Open postman and make a put request to
https://api.ibm.com/watsonanalytics/run/oauth2/v1/config
In body of put,enter like this.
{
"ownerName": "asdf",
"clientName": "sdfasd",
"redirectURIs": "https://localhost:6001",
"ownerPhone": "9999999999",
"ownerCompany": "asdf",
"ownerEmail": asdfasdfs@sdfsd.com
}
replace junk with your info, this needs to be done once and put response will get the info you need.
Next time you can do a get on above url with headers, it will spit out the client info to you.
You are all set to push docs to analytics.
But we have client id only and we need auth code also, if you try without that you get below error.
"Failed to verify OAuth information. Transaction ID=42
so lets get the auth code
Open a browser and paste this.
Make sure you redirect url is same and is reachable, else you will get some background database not reachable error.
give permissions to the app.
You will get a call back with authcode likethis.
Use this code in our node app, valid for 1 hour.
Don’ know why ibm confused so much with auths and tokens but friends.. one more step
we need access token before we get the data assets i know it sucks and sounds redundant.
use a decoder service to decode encoded code
Now we use this auth code to get token
https://api.ibm.com/watsonanalytics/run/oauth2/v1/token
Ref these docs, i could pass from here, tried different grant_type, all of them which were assigned to me in config , but none worked.
{
"error": "invalid_client"
}
===================Not working….. from here…..so i moved to another analytics solution.. mailed ibm india team but no reply..
Ref.
github repo. followed instructions but didnt work .
https://github.com/WatsonAnalytics/oauth2-nodejs
https://developer.ibm.com/watson-analytics/#getstarted
Other errors encountered.
These were due to different tenants, i was using for calling the auth requests or may be i was using localhost instead of actual reachalbe url of my app.(This one got fixed after using reachable url)
error_description": "Invalid grant type. TransactionI
couldn’t proceed after this and tried lot of things, but didn’t work.I tried with both Partner accounts and general public free accounts.
No comments:
Post a Comment