# How to use the API from a development environment

**URL:** <https://forums.eveonline.com/t/how-to-use-the-api-from-a-development-environment/228770>\
**Category:** Third Party Developers\
**Created:** [March 30, 2020, 2:04pm UTC](https://forums.eveonline.com/t/how-to-use-the-api-from-a-development-environment/228770 "2020-03-30T14:04:08Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ishi\_La](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/ishi_la/32/194549_2.png) [@Ishi\_La](https://forums.eveonline.com/u/Ishi_La)\
**Post date:** [March 30, 2020, 2:04pm UTC](https://forums.eveonline.com/t/how-to-use-the-api-from-a-development-environment/228770/1 "2020-03-30T14:04:08Z")

</div>

I am developing my app from a localhost on my computer. I have an issue getting the authorization token. When I try to get the authorization code in step 5 of: [https://docs.esi.evetech.net/docs/sso/web\_based\_sso\_flow.html](https://docs.esi.evetech.net/docs/sso/web_based_sso_flow.html). I get a network error : `net::ERR_HTTP2_PROTOCOL_ERROR`. I think this is because of the lack of an ssl certificate.

How can I use the API to develop on my localhost?

---

<div class="post-metadata">

**Author:** ![Blacksmoke16](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/blacksmoke16/32/376589_2.png) [@Blacksmoke16](https://forums.eveonline.com/u/Blacksmoke16)\
**Post date:** [March 30, 2020, 4:49pm UTC](https://forums.eveonline.com/t/how-to-use-the-api-from-a-development-environment/228770/2 "2020-03-30T16:49:25Z")

</div>

Can you share some of the code you’re using? One thing to try would be doing it all manually via curl or postman or something to rule out your code.

---

<div class="post-metadata">

**Author:** ![Ishi\_La](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/ishi_la/32/194549_2.png) [@Ishi\_La](https://forums.eveonline.com/u/Ishi_La)\
**Post date:** [March 30, 2020, 4:53pm UTC](https://forums.eveonline.com/t/how-to-use-the-api-from-a-development-environment/228770/3 "2020-03-30T16:53:03Z")

</div>

```
      fetch( `https://login.eveonline.com/v2/oauth/token?grant_type=authorization_code&code=${code}`, {
        method: 'POST',
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded',
          'Host': 'login.eveonline.com',
          'Authorization': 'Basic fdakjfhdksfhdsufhdsiufhadifofafds'
        }
      })

```

Code is the code returned in the url. I made up the auth-key.

---

<div class="post-metadata">

**Author:** ![Blacksmoke16](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/blacksmoke16/32/376589_2.png) [@Blacksmoke16](https://forums.eveonline.com/u/Blacksmoke16)\
**Post date:** [March 30, 2020, 5:00pm UTC](https://forums.eveonline.com/t/how-to-use-the-api-from-a-development-environment/228770/4 "2020-03-30T17:00:15Z")

</div>

I would try seeing if you can get an access token manually by doing the requests. That would determine if the issue is with your code or not.

Also what is the exact error you’re getting? I.e. what is in the response body of the request?

---

<div class="post-metadata">

**Author:** ![Ishi\_La](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/ishi_la/32/194549_2.png) [@Ishi\_La](https://forums.eveonline.com/u/Ishi_La)\
**Post date:** [March 30, 2020, 5:04pm UTC](https://forums.eveonline.com/t/how-to-use-the-api-from-a-development-environment/228770/5 "2020-03-30T17:04:42Z")

</div>

This is the error I get where usually a status code is shown.

> [@Ishi\_La](#):
>
> net::ERR\_HTTP2\_PROTOCOL\_ERROR

If I omit the authorization header I do get a response ( `{"error":"invalid_client","error_description":"Missing or invalid client credentials."}`)

---

<div class="post-metadata">

**Author:** ![Blacksmoke16](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/blacksmoke16/32/376589_2.png) [@Blacksmoke16](https://forums.eveonline.com/u/Blacksmoke16)\
**Post date:** [March 30, 2020, 5:06pm UTC](https://forums.eveonline.com/t/how-to-use-the-api-from-a-development-environment/228770/6 "2020-03-30T17:06:37Z")

</div>

> [@Blacksmoke16](#):
>
> I would try seeing if you can get an access token manually by doing the requests. That would determine if the issue is with your code or not.

This is the next step I would take, then we can go from there.

---

<div class="post-metadata">

**Author:** ![Steve\_Ronuken](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/steve_ronuken/32/373894_2.png) [@Steve\_Ronuken](https://forums.eveonline.com/u/Steve_Ronuken)\
**Post date:** [March 30, 2020, 5:55pm UTC](https://forums.eveonline.com/t/how-to-use-the-api-from-a-development-environment/228770/7 "2020-03-30T17:55:01Z")

</div>

You don’t need an ssl certificate.

ESI never initiates a connection to your server, it only responds to it.  
As long as your client can talk to your server, it’s fine.

If you don’t have a certificate, just make sure that the return url that you set in your application doesn’t have https in it.

---

<div class="post-metadata">

**Author:** ![Ishi\_La](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/ishi_la/32/194549_2.png) [@Ishi\_La](https://forums.eveonline.com/u/Ishi_La)\
**Post date:** [March 30, 2020, 6:45pm UTC](https://forums.eveonline.com/t/how-to-use-the-api-from-a-development-environment/228770/8 "2020-03-30T18:45:07Z")

</div>

It works with postman. I used the generated code from postman ( in angular9 ) and I keep getting the same error.

```
this.route.queryParamMap.subscribe( params => {
let code = params.get('code');
// postman code
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
myHeaders.append("Host", "login.eveonline.com");
myHeaders.append("Authorization", "Basic NThmYjljMGEwMWM5NGI1ODhkNmUzYzVlMTQ4NjYyYjQ6eVRUUzFGRTBjR2dwRjhEZEN1MWhMSE5YNk5RMFIwdUtZTzBNZkpCZw==");
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");

var urlencoded = new URLSearchParams();
urlencoded.append("grant_type", "authorization_code");
urlencoded.append("code", code);

fetch("https://login.eveonline.com/v2/oauth/token", {
  method: 'POST',
  headers: myHeaders,
  body: urlencoded,
  redirect: 'follow'
})
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
// end postman code
});
```

---

<div class="post-metadata">

**Author:** ![Ishi\_La](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/ishi_la/32/194549_2.png) [@Ishi\_La](https://forums.eveonline.com/u/Ishi_La)\
**Post date:** [March 30, 2020, 6:59pm UTC](https://forums.eveonline.com/t/how-to-use-the-api-from-a-development-environment/228770/9 "2020-03-30T18:59:18Z")

</div>

In firefox I get a more useful message: ‘Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at [https://login.eveonline.com/v2/oauth/token](https://login.eveonline.com/v2/oauth/token). (Reason: CORS request did not succeed).’

---

<div class="post-metadata">

**Author:** ![Blacksmoke16](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/blacksmoke16/32/376589_2.png) [@Blacksmoke16](https://forums.eveonline.com/u/Blacksmoke16)\
**Post date:** [April 1, 2020, 12:43pm UTC](https://forums.eveonline.com/t/how-to-use-the-api-from-a-development-environment/228770/10 "2020-04-01T12:43:12Z")

</div>

See [https://github.com/esi/esi-issues/issues/1188#issuecomment-607225808](https://github.com/esi/esi-issues/issues/1188#issuecomment-607225808)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/eveonline/original/3X/4/1/41ec4921cbaca7a6f9ea556e7cc20018461eae5e.png) [@system](https://forums.eveonline.com/u/system)\
**Post date:** [June 30, 2020, 12:43pm UTC](https://forums.eveonline.com/t/how-to-use-the-api-from-a-development-environment/228770/11 "2020-06-30T12:43:15Z")

</div>

Closed on June 30, 2020, 12:43pm UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
