0

The backend returns the token in the html code and I can't get it out

<meta name="sessid" content="900959d22b2a4724a31425fad1895fbf">

Angular2 has its own page index.html in development mode (called ng serve)

d689440
  • 51
  • 2
  • How are you requesting the token from the backend? – Octavian Mărculescu Nov 16 '21 at 16:19
  • you could search the body: `const matches = body.match(/meta name="sessid" content="(.+?)"/)` – Get Off My Lawn Nov 16 '21 at 16:25
  • If you include the compiled angular result on the html output page (backend php), then you can extract data from the meta tag or some any. But when developed separately from backend, when call ng serve (localhost:4200), index.html does not contain a token (there is only static). – d689440 Nov 16 '21 at 16:49
  • Check the sample here https://github.com/jeroenheijmans/sample-angular-oauth2-oidc-with-auth-guards/ – Lonli-Lokli Nov 09 '22 at 07:50

0 Answers0