Google oauth + hilla?

How would i go about adapting this https://vaadin.com/blog/oauth-2-and-google-sign-in-for-a-vaadin-application
to hilla project?

Like i can probably do the anchor with oauth url, but what about the auth checks?

I’m working on a tutorial for that. Here’s an example. There may still be some bugs, I haven’t fully reviewed it yet GitHub - marcushellberg/hilla-google-auth

thanks!

I’m hoping to polish it up and publish in the next 2 weeks

Im doing a long overdue university project so i’ll just slap some backend requests for now and deal with it later if i have any time left

:D

:see_no_evil:

Haha, sounds good. In that case, that should work just fine

How do i add the auth check on the router level though?

like in flow we have the annotations to configure that, what about hilla?

Are you using Lit or React?

Lit

You can create an app with npx @hilla/cli init --auth hilla-auth and see how the starter does it using actions

Essentially

 action: async (_context, _command) => {
      if (!hasAccess(_context.route)) {
        return _command.redirect('login');
      }
      await import('./views/about/about-view');
      return;
    },

ngl i never used npx or npm, but i downloaded the starter app with the configured security and from what i see, it asks the endpoint and then stores it in appStore

and from there i can already get that info inside the router

reimplemented it as i already had an endpoint for user info, seems to work fine so far

Remember that you should never rely on client-side security checks. What’s important is endpoint security.

yeah i always double check on the endpoint