FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    Angular example using a nodejs backend

    Scheduled Pinned Locked Moved
    General Discussion
    0
    2
    543
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      didier.rano
      last edited by

      Hi, fusionauth provides an application example using Angular. This example contains a frontend part and a middleware with nodejs.
      Is it possible to use only Angular without a middleware? And only pass JWT token to backend?

      1 Reply Last reply Reply Quote 0
      • danD
        dan
        last edited by

        Sure, store the access token in a secure cookie.

        We don't have any examples of that with Angular, but here's a diagram of the flow: https://fusionauth.io/learn/expert-advice/authentication/spa/oauth-authorization-code-grant-jwts-refresh-tokens-cookies/

        You'll still have to have some kind of backend because server side code is required to exchange the authorization code for the access token, as above. But you can then have the JWT be stored as a cookie and sent to APIs without further interaction with the backend server.

        The alternative is to use the implicit grant, documented here: https://fusionauth.io/docs/v1/tech/oauth/overview#example-implicit-grant

        But we strongly advise against that since it exposes your access tokens to XSS attacks.

        --
        FusionAuth - Auth for devs, built by devs.
        https://fusionauth.io

        1 Reply Last reply Reply Quote 0
        • First post
          Last post