DEV Community

Discussion on: How to Secure JWT in a Single-Page Application

Collapse
 
atimetoremember profile image
Son Le Si • Edited

Nice article, but I have a question, If I want to design an API that is used by both web and mobile, so how can I design it for mobile?, because mobile doesn't support for cookie like the web. Hope to get reply from you and other contributors.

Collapse
 
nilanth profile image
Nilanth

Thanks for your question.
This approach is only for web, for mobile it is completely different, we need pass the JWT as Authorization bearer token. so we need to go with separate APIs. for example api/mobile/login instead of api/web/login

Collapse
 
ichavezf profile image
Eduardo Chavez

you want try secure storage, sqlite, sharedpreferences.. etc etc

Some comments have been hidden by the post's author - find out more