# API Connection Help

**URL:** <https://community.easymorph.com/t/api-connection-help/4653>\
**Category:** General Q&A\
**Created:** [July 20, 2023, 1:55pm UTC](https://community.easymorph.com/t/api-connection-help/4653 "2023-07-20T13:55:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![htims05](https://community.easymorph.com/letter_avatar_proxy/v4/letter/h/4491bb/32.png) [@htims05](https://community.easymorph.com/u/htims05)\
**Post date:** [July 20, 2023, 1:55pm UTC](https://community.easymorph.com/t/api-connection-help/4653/1 "2023-07-20T13:55:27Z")

</div>

I have an API that is part of my companies systems. I can connect to it via Postman but I'm having trouble converting that connection to easymorph's Web Location connector.

In postman, I have a POST call that authorizes me - the url is something like [https://someURL.com/aas/oauth/token](https://someURL.com/aas/oauth/token). In this call, I pass via postman's "authorization" tab of the call a User Name and Password (our internal team calls this the Client and Secret) which gives me access to the API itself.

Also in the same call within postman the "Body" tab of the call, pass 'username', 'password', and 'grant\_type'. This username/password is the authentication of the application I'm accessing (if I log into the UI of the application this is what I would use).

Once the call is run, it returns a few fields, most notably the 'access\_token', 'refresh\_token', 'token\_type'. In postman call I have a script that takes these tokens and saves them as environment variables so that they can be used for other calls (GET, PATCH, POST) without having to authenticate for each one of those calls.

Where I'm confused is how to convert the postman authentication call to the easymorph web location connection?

---

<div class="post-metadata">

**Author:** ![ckononenko](https://community.easymorph.com/user_avatar/community.easymorph.com/ckononenko/32/7044_2.png) [@ckononenko](https://community.easymorph.com/u/ckononenko)\
**Post date:** [July 20, 2023, 5:02pm UTC](https://community.easymorph.com/t/api-connection-help/4653/2 "2023-07-20T17:02:53Z")

</div>

Hi @htims05

EasyMorph `WebRequest` can handle `OAuth2` with `Authorization Code` grant type automatically. (`grant_type=authorization_code`).

Other authorization methods require a slightly complex workflow design.

Can you show the API documentation? Or at least specify the `grant_type` you want to use.

---

<div class="post-metadata">

**Author:** ![htims05](https://community.easymorph.com/letter_avatar_proxy/v4/letter/h/4491bb/32.png) [@htims05](https://community.easymorph.com/u/htims05)\
**Post date:** [July 20, 2023, 5:20pm UTC](https://community.easymorph.com/t/api-connection-help/4653/3 "2023-07-20T17:20:33Z")

</div>

grant\_type is 'password' - unfortunately I can't share the API documentation.

I was able to get it to work with WebRequest by following this - [How to perform OAuth Client Credentials Flow](https://community.easymorph.com/t/how-to-perform-oauth-client-credentials-flow/3952)

What I'm trying to figure out now is how to use WebRequest after authenticating to POST data to the API - that data from another table or EasyMorph project.

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [July 20, 2023, 6:42pm UTC](https://community.easymorph.com/t/api-connection-help/4653/4 "2023-07-20T18:42:07Z")

</div>

> [@htims05](#):
>
> What I’m trying to figure out now is how to use WebRequest after authenticating to POST data to the API

Just keep adding the `Authorization` header with the access token to all consequent web requests, as displayed in [the last image](https://community.easymorph.com/uploads/default/original/2X/4/4de8afbff158dc2ec27ccb738491133323025d11.png) of the topic you mentioned. The token is effectively a proof of authorization.
