Fork me on GitHub
#nbb
<
2022-07-26
>
Hankstenberg11:07:59

Hi guys, I'm looking for a way to do OAuth2 authentication and HTTP requests with nbb. What would you say is the most straightforward way to do this? I'm currently thinking about wrapping axios and axios-oauth-client, but I would like to know if there isn't a better way.

borkdude11:07:58

There isn't an nbb-specific way to do it, so in this case, do whatever works best on Node.js. Perhaps someone in this channel has experience with that

borkdude11:07:15

Hmm @roseneck I see that sitefox, a web "framework" compatible with nbb, does have some oauth stuff: https://github.com/chr15m/sitefox/blob/main/README.md and it mentions the https://www.passportjs.org/ library

Hankstenberg11:07:38

Thanks a lot, I'll check it out! 🙂

Hankstenberg11:07:25

By the way, thanks so much for creating these awesome tools.

❤️ 1
genRaiy13:07:27

You might find that the oauth server has a nodejs library eg auth0 does

genRaiy13:07:55

Otherwise yeah passport or axios are good

lilactown14:07:25

just wanna say: nbb is great! I needed to use the source-map JS package in a script and nbb let me whip it up in no time with the help of Clojure's core library. Very impressive work!

❤️ 1
lilactown14:07:35

I remember trying to use lumo for similar type of stuff years ago and doing anything other than running a single file was a huge pain, installing it was a pain, just a lot of rough edges. a lot of thought and work has gone into bb and nbb to allow a whole slew of use cases that were previously unavailable to the clojure ecosystem. 👏:skin-tone-2:

🙇 1
1
borkdude14:07:43

Thanks @lilactown - never get tired of hearing this =)

gratitude 1
borkdude14:07:30

What I'm also excited about is that nbb will not only work on Node.js but also on bun and bun has great FFI support, which again will open up new possibilities

lilactown14:07:10

yeah bun seems super cool

lilactown14:07:03

huh I didn't realize bun could run react

lilactown14:07:20

for some reason I thought it was missing some Nodejs compat stuff

borkdude14:07:42

@lilactown Note that when you do bun nbb ... it won't run bun, but still Node.js due to the shebang in the nbb startup .js script. I've requested in the bun discord if this could be changed and they are considering it but right now you'll need a run.mjs wrapper which calls loadFile from the nbb package

lilactown14:07:38

hmm interesting. is that a bun problem or a nbb problem?

borkdude14:07:36

it's similar to other CLIs you invoke in bun, they did this on purpose because the Node.js compatibility isn't fully mature yet

lilactown14:07:17

we could have bb, nbb and bbb 😄

lilactown14:07:46

I can't find any info on how bun is funded

borkdude14:07:15

I would prefer nbb to just run on bun and maintain just one codebase. Currently you can do it the way it's documented above

💯 1
borkdude14:07:05

bun is very early days and experimental, it's probably better to wait for them to fix the Node.js compatibility, it's one of their priorities

lilactown14:07:21

idk how this guy was able to work on this for year(s). very curious if he's received funding or bootstrapped. I see he's a thiel fellow. makes me wonder where he intends to take the project w.r.t. funding in the future, e.g. go the VC route like deno did.

lilactown14:07:35

would probably change how I interacted with the project if I knew he had a corporate backer vs. VC vs. OSS community funding 🙂

borkdude15:07:14

@lilactown He was teasing on Twitter that some important new will come in the near future

borkdude15:07:16

So who knows

sirwobin15:07:22

How should I include clojurescript dependencies in an nbb project? Is there a guide?

sirwobin15:07:44

I see a discussion in the README about classpath but that doesn't actually address how to specify the libs (like in lein deps)

borkdude15:07:03

@sirwobin It depends which dependency. If you use git deps then you can use them directly like so:

nbb --classpath $(clojure -Spath)
but nbb can't currently read dependencies from .jar files. However, there is a workaround for that here: https://github.com/babashka/nbb/blob/main/doc/dependencies.md There is a PR to improve this, but still need to look at this

borkdude15:07:26

Also note that not all CLJS deps are compatible with nbb so you'll likely run into something, which you're welcome to report

sirwobin15:07:45

I'll have a look. Thanks again!

genRaiy19:07:23

@borkdude does the cherry project enable js to cljs interop?

genRaiy19:07:50

ie a JS program can call the API of the exposed ES module?

genRaiy19:07:08

I see it has its own channel ... I'll repost there