Using JWT authentication with Oboe,js

86 views Asked by At

I'm still a noob at web development and attempting to implement JWT authentication for web application that consists of an HTML page with JavaScript. It retrieves data by firing WebAPI endpoints via Oboe.js.

I have already managed to successfully retrieve the token from the cookie. Now I just need to use it in my oboe calls somehow.

Is this possible? Does Oboe.js support JWT authentication? Or should I find an alternative to Oboe.JS and use $.ajax calls instead?

If it is possible, I really would appreciate any help with this!

Thanks in advance everyone!

1

There are 1 answers

1
JuanCaicedo On

You should obtain your JWT token separately, then you can pass an Authorization header to oboe and it will attach it to your request

How to generate your JWT token will be specific to the backend you are using, but usually you will have an endpoint that you can pass credentials to, and another that you can use to refresh your token.

This page talks about using an Authorization header https://jwt.io/introduction/

You can pass a header property to oboe when you are creating your request http://www.oboejs.com/api