Cov txheej txheem:

JWT tau lees paub li cas?
JWT tau lees paub li cas?

Video: JWT tau lees paub li cas?

Video: JWT tau lees paub li cas?
Video: yuav coj li cas kom luag nyiam 2024, Kaum ib hlis
Anonim

Daim ntawv thov neeg rau zaub mov, tsis yog tsuas yog siv lub npe siv los ntawm header, yuav ua ntej siv tau tus JWT : yog tias kos npe raug, ces tus neeg siv yog raug muaj tseeb thiab qhov kev thov mus dhau. yog tias tsis yog, daim ntawv thov server tuaj yeem tsis lees txais qhov kev thov.

Tsis tas li ntawd, kuv yuav ua li cas thiaj lees paub JWT kos npe?

Txhawm rau txheeb xyuas qhov kos npe, koj yuav tsum:

  1. Xyuas qhov kos npe algorithm. Rov qab tau cov cuab yeej alg los ntawm qhov txiav tawm Header.
  2. Paub meej tias lub token raug kos npe raug siv tus yuam sij kom raug. Tshawb xyuas Kos Npe txhawm rau txheeb xyuas tias tus neeg xa khoom ntawm JWT yog leej twg nws hais tias nws yog thiab cov lus tsis raug hloov raws txoj kev.

Ib sab saum toj no, muaj pes tsawg ntu ua JSON Web Token JWT muaj rau kev lees paub qhov tseeb ntawm tus neeg siv khoom? Siv tau kos npe A JWT muaj peb ntu , header, lub cev, thiab kos npe. Qhov kos npe ntu tau siv rau validate lub authenticity ntawm token yog li ntawd nws ua tau ntseeg tau los ntawm koj daim ntawv thov.

Hais txog qhov no, vim li cas JWT tsis ruaj ntseg?

Cov ntsiab lus hauv json web token ( JWT ) yog tsis yog nyob rau hauv ruaj ntseg , tab sis muaj ib tug built-in feature rau kev txheeb xyuas token authenticity. Lub asymmetric xwm ntawm pej xeem tus yuam sij cryptography ua JWT kos npe pov thawj tau. Tus yuam sij pej xeem txheeb xyuas a JWT tau kos npe los ntawm nws tus yuam sij ntiag tug.

Puas yog JWT yog OAuth?

Hauv paus, JWT yog hom ntawv token. OAuth yog kev tso cai raws tu qauv siv tau JWT raws li lub cim. OAuth siv server-sab thiab client-side cia. Yog tias koj xav ua tiag logout koj yuav tsum mus nrog OAuth 2.

Pom zoo: