Generate an access token/JWT with curl

Highlighted
Occasional Contributor

Generate an access token/JWT with curl

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 4
Highlighted
Box Employee

Re: Generate an access token/JWT with curl

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/

Highlighted
Occasional Contributor

Re: Generate an access token/JWT with curl

Thanks @anoland , 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

Highlighted
Occasional Contributor

Re: Generate an access token/JWT with curl

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

Occasional Contributor

Re: Generate an access token/JWT with curl

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/