I am able to retrieve the XML for an access token using the following VB6 code:
With http
.HTTPPostOption = "POST"
.Inputs.Add "client_credentials", "grant_type"
Call .SetRequestHeader("Authorization", ... my encoded key ...)
.URL = ..../3.1/auth/accesstoken" 'Circumvent the forum's "too spamy" msg
sHTML = .SendRequest()
End With
But when I try to provide the access token (extracted from the XML returned by the previous) in the next call using this code:
With http
.HTTPPostOption = "GET"
Call .SetRequestHeader("Authorization", ... my access token ...)
.URL = .../3.1/rest-services/published-data/publication/docdb/CO5540388/biblio" 'Circumvent the forum's "too spamy" msg
sHTML = .SendRequest()
Return
End With
What gets returned is <error><code>500</code><message>InvalidAccessToken</message></error>
Cannot retrieve data after obtaining token
-
- Posts: 1298
- Joined: Thu Feb 22, 2007 5:32 pm
Re: Cannot retrieve data after obtaining token
Dear user,
Could it be that you either misspelled something in access tocken or possibly did not use "Bearer"?? Please check carefully OPS documentation again.
Kind regards,
OPS support
Could it be that you either misspelled something in access tocken or possibly did not use "Bearer"?? Please check carefully OPS documentation again.
Kind regards,
OPS support
Re: Cannot retrieve data after obtaining token
That fixed it. I was thrown off by the documentation for getting the AccessToken (page 41) where it said the AuthorizationHeader is Basic followed by the encoded Consumer key. That call works without the 'Basic'. Should that documentation be corrected?
-
- Posts: 1298
- Joined: Thu Feb 22, 2007 5:32 pm
Re: Cannot retrieve data after obtaining token
Dear user,
You should have been looking at example on page 42 and not 41. 41 was for POST and you wanted GET
See attached:
Kind regards,
OPS support
You should have been looking at example on page 42 and not 41. 41 was for POST and you wanted GET
See attached:
Kind regards,
OPS support
- Attachments
-
- token.png (21.15 KiB) Viewed 3601 times