Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV forum
Unanswered

sending bearer token authentication in external API from NAV C/AL code

Posted on by 25

Hello All,

I am trying to use an API which is authenticated using bearer token. I have managed to generate access token from the provided API but How do I send the generated access token to another API for accessing its data. Below is the code :- 


HttpClient.BaseAddress := Uri.Uri(provide base url);
HttpResponseMessage := HttpClient.PostAsync(provided api path,HttpContent).Result;
HttpResponseMessage.EnsureSuccessStatusCode();
result := HttpResponseMessage.Content.ReadAsStringAsync.Result;
MESSAGE(FORMAT(result.ToString));

Any help would be appreciated.

Thanks

  • Alexei Pavlov Profile Picture
    Alexei Pavlov 20 on at
    RE: sending bearer token authentication in external API from NAV C/AL code

    I think you should use request header "Authentication" with "Bearer TOKEN_HERE".

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,989 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,588 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans