# HTTPS get session token using curl doesn't work (?)

**URL:** <https://discuss.blues.com/t/https-get-session-token-using-curl-doesnt-work/258>\
**Category:** Uncategorized\
**Created:** [May 12, 2021, 3:16pm UTC](https://discuss.blues.com/t/https-get-session-token-using-curl-doesnt-work/258 "2021-05-12T15:16:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![BrianP](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@BrianP](https://discuss.blues.com/u/BrianP)\
**Post date:** [May 12, 2021, 3:16pm UTC](https://discuss.blues.com/t/https-get-session-token-using-curl-doesnt-work/258/1 "2021-05-12T15:16:28Z")

</div>

I have tried the examples to use curl to get the session token using curl ([Notecard Quickstart - Blues Developers](https://dev.blues.io/build/quickstart/notecarrier-af/#send-notes-from-notehub-to-notecard))

On ubuntu / Windows 10 or wsl I get the same result, basically an empty line (note: email address and password are changed below but I am pretty sure they are correct)

brian@LAPTOP-70Q5CT1Q:/mnt/c/WINDOWS/system32$ curl --request POST --location “[https://api.notefile.net/auth/login](https://api.notefile.net/auth/login)” --data ‘{“[username":"brian@myemailaddress.com](mailto:username%22:%22brian@myemailaddress.com)”, “password”:“mypassword!”}’  
brian@LAPTOP-70Q5CT1Q:/mnt/c/WINDOWS/system32$

Invoking verbose  
curl --verbose --request POST --location “[https://api.notefile.net/auth/login](https://api.notefile.net/auth/login)” \

> –data ‘{“[username":"brian@myemailaddress.com](mailto:username%22:%22brian@myemailaddress.com)”, “password”:“mypassword!”}’  
> Note: Unnecessary use of -X or --request, POST is already inferred.

- Trying 34.197.91.124…
- TCP\_NODELAY set
- Connected to [api.notefile.net](http://api.notefile.net) (34.197.91.124) port 443 (#0)
- ALPN, offering h2
- ALPN, offering http/1.1
- successfully set certificate verify locations:
- CAfile: /etc/ssl/certs/ca-certificates.crt  
CApath: /etc/ssl/certs
- TLSv1.3 (OUT), TLS handshake, Client hello (1):
- TLSv1.3 (IN), TLS handshake, Server hello (2):
- TLSv1.2 (IN), TLS handshake, Certificate (11):
- TLSv1.2 (IN), TLS handshake, Server key exchange (12):
- TLSv1.2 (IN), TLS handshake, Server finished (14):
- TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
- TLSv1.2 (OUT), TLS change cipher, Client hello (1):
- TLSv1.2 (OUT), TLS handshake, Finished (20):
- TLSv1.2 (IN), TLS handshake, Finished (20):
- SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
- ALPN, server accepted to use h2
- Server certificate:
- subject: CN=\*.notefile.net
- start date: Aug 26 00:00:00 2020 GMT
- expire date: Sep 25 12:00:00 2021 GMT
- subjectAltName: host “[api.notefile.net](http://api.notefile.net)” matched cert’s “\*.notefile.net”
- issuer: C=US; O=Amazon; OU=Server CA 1B; CN=Amazon
- SSL certificate verify ok.
- Using HTTP2, server supports multi-use
- Connection state changed (HTTP/2 confirmed)
- Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
- Using Stream ID: 1 (easy handle 0x7ffff54d3860)

> POST /auth/login HTTP/2  
> Host: [api.notefile.net](http://api.notefile.net)  
> User-Agent: curl/7.58.0  
> Accept: _/_  
> Content-Length: 68  
> Content-Type: application/x-www-form-urlencoded

- Connection state changed (MAX\_CONCURRENT\_STREAMS updated)!
- We are completely uploaded and fine  
\< HTTP/2 400  
\< date: Wed, 12 May 2021 15:06:52 GMT  
\< content-length: 0  
\< vary: Origin  
\<
- Connection #0 to host [api.notefile.net](http://api.notefile.net) left intact

Seems to suggest I am getting the certificate but I don’t know enough about this stuff to figure out if that is indeed the case.

Regardless, I do not see a reply similar to the one in the example, namely  
{“session\_token”: “00000000000000000000000000000000”}

What am I doing wrong?

Thanks

---

<div class="post-metadata">

**Author:** ![zfields](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/zfields/32/29_2.png) [@zfields](https://discuss.blues.com/u/zfields)\
**Post date:** [May 12, 2021, 3:35pm UTC](https://discuss.blues.com/t/https-get-session-token-using-curl-doesnt-work/258/2 "2021-05-12T15:35:18Z")

</div>

I noticed the quotation marks (`"`) in the terminal output you shared _(shown below)_ are two different kinds, `“` and `"`. It’s hard to see in most editors, but it makes a big difference to CURL.

```auto
brian@LAPTOP-70Q5CT1Q:/mnt/c/WINDOWS/system32$ curl --request POST --location “https://api.notefile.net/auth/login” --data ‘{“username":"brian@myemailaddress.com”, “password”:“mypassword!”}’
brian@LAPTOP-70Q5CT1Q:/mnt/c/WINDOWS/system32$

```

The bizarre quotation marks usually appear if you were to highlight the text and press Ctrl+C. As a sanity test, I clicked the **COPY** button on the webpage you shared, entered my own credentials, and I received a session token.

To ensure we are starting on the same footing, would you mind to go through the process once again, but being sure to press the **COPY** button?

---

<div class="post-metadata">

**Author:** ![BrianP](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@BrianP](https://discuss.blues.com/u/BrianP)\
**Post date:** [May 12, 2021, 4:06pm UTC](https://discuss.blues.com/t/https-get-session-token-using-curl-doesnt-work/258/3 "2021-05-12T16:06:46Z")

</div>

Zach  
I did indeed press copy and, just in case, I did it again. I suspect the weird quotation marks are an artifact of this forum’s paste. Just in case I retyped the line and got the same result.

However, you put me on the right track: I had reset my password but apparently it didn’t “take” until I logged out and logged back in again.

Apparently I was passing an old password.

Sometimes its hard to know if you are following the instructions right or otherwise screwing up.

Now I get a valid response.

Thanks!

---

<div class="post-metadata">

**Author:** ![BrianP](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@BrianP](https://discuss.blues.com/u/BrianP)\
**Post date:** [May 12, 2021, 5:03pm UTC](https://discuss.blues.com/t/https-get-session-token-using-curl-doesnt-work/258/4 "2021-05-12T17:03:34Z")

</div>

Zach  
Sorry for the spam. Now that I can send a note to the Notecard via Notehub and curl, do you know the syntax for getting a note from Notehub?

I uploaded a Note from my Notecard with the example and I see it on Notehub

I tried to reverse engineer a “get” and ended up with this  
curl --request POST --location ‘[https://api.notefile.net/req](https://api.notefile.net/req)’   
–header 'X-SESSION-TOKEN: ’   
–data ‘{“req”:“note.get”,“file”:“sensors.qo”,  
“product”:"",“device”:“dev:”}’

I get a reply  
{“err”:“no notes available in queue {note-noexist}”}

But I can see the note on NoteHub

Thanks

---

<div class="post-metadata">

**Author:** ![zfields](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/zfields/32/29_2.png) [@zfields](https://discuss.blues.com/u/zfields)\
**Post date:** [May 12, 2021, 5:17pm UTC](https://discuss.blues.com/t/https-get-session-token-using-curl-doesnt-work/258/5 "2021-05-12T17:17:10Z")

</div>

Hi Brian,

I’m glad to hear you have been successful in sending Notes to [Notehub.io](http://Notehub.io)!

To receive Notes, we have [Notehub Routes](https://dev.blues.io/build/tutorials/route-tutorial/), where you can create custom routing paths and specify your server as the endpoint.

![notehub-routes-tab](https://us1.discourse-cdn.com/flex020/uploads/blues/original/1X/00ade911a5043e06f8e1ef8984491d5f50d5dedf.png)

---

<div class="post-metadata">

**Author:** ![BrianP](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@BrianP](https://discuss.blues.com/u/BrianP)\
**Post date:** [May 12, 2021, 5:37pm UTC](https://discuss.blues.com/t/https-get-session-token-using-curl-doesnt-work/258/6 "2021-05-12T17:37:15Z")

</div>

Zack, thanks, I was aware of the routes aspect. That requires I set up a server or a cloud service of some sort. At least for testing (and potentially as an end use) I imagine something like an Android app to query your Notehub directly via HTTP.

It seems to make sense to me that if I can push a message from an app to the Notecard via Notehub (as I have now done successfully) I should be able to do the reverse and get a message from Notehub. Are you suggesting this is not the case?

---

<div class="post-metadata">

**Author:** ![zfields](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/zfields/32/29_2.png) [@zfields](https://discuss.blues.com/u/zfields)\
**Post date:** [May 13, 2021, 3:43pm UTC](https://discuss.blues.com/t/https-get-session-token-using-curl-doesnt-work/258/7 "2021-05-13T15:43:34Z")

</div>

Hi Brian,

We are finalizing this feature as we speak, and official documentation and support are coming soon!

I’ll report back to this thread with a link to the documentation, once it is available.

---

<div class="post-metadata">

**Author:** ![BrianP](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@BrianP](https://discuss.blues.com/u/BrianP)\
**Post date:** [May 13, 2021, 3:58pm UTC](https://discuss.blues.com/t/https-get-session-token-using-curl-doesnt-work/258/8 "2021-05-13T15:58:09Z")

</div>

Zach  
I actually made some progress.

> [@HTTP API: Making Progress But a Few Questions](https://discuss.blues.com/t/http-api-making-progress-but-a-few-questions/263/2):
>
> Hi @BrianP , When you say you “deleted all the notes”, did you do that in the [Notehub.io](http://Notehub.io) UI by selecting notes and deleting them?

Sometimes going for a 3 hour walk helps!
