j-toker icon indicating copy to clipboard operation
j-toker copied to clipboard

Retrieve headers token

Open llaine opened this issue 9 years ago • 4 comments

I'm working with the window fetch polyfill library and I'm trying retrieve data from the secure API.
How can I get the tokens that are use for every request in J-Toker and use them with the fetch lib.

Is there any kind of function to do something like that ?

import Auth from './auth-configuration';
// Getting the tokens
const tokens = Auth.getTokens();
// And use them is the request
fetch('/secure-api', tokens).then(...)

llaine avatar Feb 23 '16 15:02 llaine

anyone ?

llaine avatar Mar 01 '16 14:03 llaine

Looks like $.auth.retrieveData('authHeaders') will retrieve the headers.

jrforrest avatar Aug 06 '16 18:08 jrforrest

If you specify that as your headers, it will log you out. How do I put the headers in and still be able to keep my user logged in?

danielmockaitis avatar Feb 02 '18 14:02 danielmockaitis

@dannymockaitis There's not a lot of detail in your problem description, but it sounds like the headers aren't getting into your request properly, causing a 401 to come back and log you out. Check out the headers in the request you're extracting the tokens for and compare them to the headers j-toker's using in its requests to verify correctness.

jrforrest avatar Feb 08 '18 02:02 jrforrest