Hi,

> curl -X POST --data \
> 'client_secret=[YOUR-CLIENT-SECRET]&client_id=[YOUR-CLIENT-ID]&grant_type=authorization_code&redirect_uri=[YOUR-REDIRECT-URI]&code=[AUTHORIZATION-CODE]'
>  \
> https://test-api.service.hmrc.gov.uk/oauth/token
> 
> 
> I’ve tried this:
> 
> $url:="https://test-api.service.hmrc.gov.uk/oauth/token";
> $body:="grant_type=authorization_code"+\
> "&client_id="+$clientID+\
> "&client_secret="+$clientSecret+\
> "&redirect_uri=urn:ietf:wg:oauth:2.0:oob"+\
> "&code="+$authCode
> $err:=HTTP Request(HTTP POST method;$url;$body;$response)
> 
> but all I get is an error saying “grant_type required”. I’ve tried fiddling 
> with the order of items in $body, but as expected it makes no difference.
> 
> I assume I’m not translating the curl example properly into 4D. Help?

Maybe send a content-type :

        Content-Type: application/x-www-form-urlencoded

Then, you need to be sure the data you send (the values of your variables) is 
properly url encoded...

HTH

Bruno LEGAY
A&C Consulting


Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to