Search code examples
vue.jsasp.net-coregoogle-oauth.net-6.0

Vue.js3 + .NET 6 API + Google login


I have a vue.js SPA, that makes ajax calls to a .NET 6 API I want users to login with their Google account, and authenticate to the API passing their google id/email What's the best way to do this?

NOTE: I'm using vue.js via a CDN link in a static HTML/JS/CSS site


Solution

  • I used to use the following method:

    1. front(vue) call google auth2
    2. get google token and post to backend(.net)
    3. call google authenticator on backend to confirm success
    4. You can Get Google UserID Name,and save it by JWT or Redis......and so on