Quantcast
Channel: Cheking if "admin" or "user" using fetch in reactjs - Stack Overflow
Browsing index pages (3 articles)
↧

Cheking if "admin" or "user" using fetch in reactjs

i need to verify when the user longin (using fetch API) if role == "admin" or "user" using token. if role == "admin" then make a redirection to /accounts for example, otherwise if it's a "user" then...

View Article


Answer by Jacob for Cheking if "admin" or "user" using fetch in reactjs

It looks like your token is in the format of a JWT, or "JSON Web Token." First of all, a caveat: it's super dangerous to expose JWTs through an API like this. It's far preferable to keep JWTs...

View Article


Answer by Bravo for Cheking if "admin" or "user" using fetch in reactjs

here's how you check for the role in the token // fake the result: var json = { result:...

View Article
Browsing index pages (3 articles)


Latest Images