Delphi/Sendgrid integration

Asked

Viewed 418 times

0

I’m trying to integrate a Delphi application with SendGrid. To configure the request I am using the RESTDebugger. I inform the

Header Authorization="Bearer" + [minha chave]
Content-Type = "application/json" 

And the JSON with the body, containing the necessary information, but when I send the request I receive the reply:

Permission denied, Wrong credentials

I do the same process using Postman application and the process works, it will be some problem of Delphi?

  • You’re consuming Sendgrid data on a Webservice, right... take a look at which authentication method is used, because if it needs a token.

  • Yes, authentication is done through the Authorization parameter in the request header, with a token generated in the Sendgrid panel.

  • 1

    Yes, but there are several types of authentication methods, if you visualize there in Delphi REST Debugger, it has the simple and basic that is with user and password, but as it is done with token has the Oauth and Oauth2, selecting one of these two below has a button for you to open their wizard to configure authentication.

  • I get it... I’ll try...

  • There is not much documentation on how to use REST Debugger with authentication, I suggest searching manually, done with Restclient, Restrequest and Restresponse.

  • Integration unit: https://gist.github.com/AndreAngelucci/dbe63815897afcbe29713ab50b43884c

Show 1 more comment

1 answer

-1

If you are using Restclient components of Delphi, in this case it would be Trestrequest, Trestclient, Trestresponse etc that under the cloths the Restdebugger uses, when passing the bearer you have to pass also the parameter poDoNotEncode:

.AddHeader('Authorization', 'Bearer dfsdkfjsldkfgjdflg', [poDoNotEncode]);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.