Skip to main content
Question

Generate an access token/JWT with curl

  • May 22, 2025
  • 4 replies
  • 15 views

Forum|alt.badge.img

Greetings,

 

I have a bash script that generates some files.

 

I'd like to upload these files to Box using the same bash script and looks like it's super simple.

 

The one thing which confuses me is authorization...is it possible to use JWT method with just raw bash/curl approach to generate an access token. Maybe somebody has some examples?

Thanks

4 replies

Forum|alt.badge.img

It is possible to generate an access token with a cURL request. We have some examples that are language specific that can be written in a more generic way, but you'll still need to handle decoding. I recommend reviewing these two pages from our developer documentation to help you get started.

https://developer.box.com/guides/authentication/jwt/without-sdk/
https://developer.box.com/reference/post-oauth2-token/


Forum|alt.badge.img

Thanks  , I'm aware about the documentation you sent me. Tho the first link shows example for python, java, php, etc, not the pure shell(bash or whatever )/curl implementation what I was asking for. The second link guides to OAuth api, and there's none information related to JWT


Forum|alt.badge.img

I gave up on JWT and ended up using just plain OAuth 2.0 with bash. If somebody interested: https://github.com/rooty0/box-oauth-uploader


Forum|alt.badge.img

I just realized that we are using a Private Key, so I HAVE to follow: https://developer.box.com/guides/authentication/jwt/without-sdk/

 

Would be great to have a bash example for this.

I am attempting this now with the help of this blog - https://willhaley.com/blog/generate-jwt-with-bash/