With Refresh Authentication#
This example shows urql in use with @urql/exchange-auth's authExchange
to support authentication token and refresh token logic. This largely follows the "Authentication" docs
page
and uses the trygql.formidable.dev/graphql/web-collections schema.
To run this example install dependencies and run the start script:
yarn install
yarn run start
# or
npm install
npm run start
This example contains:
- The
urqlbindings and a React app set up insrc/App.jsx - Some authentication glue code to store the tokens in
src/authStore.js - The
Clientand theauthExchangefrom@urql/exchange-authset up insrc/client.js - A basic login form in
src/pages/LoginForm.jsx - And a basic login guard on
src/App.jsx(Note: This isn't using a query in this particular component, since this is just an example)