You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m working on an application which is composed by a frontend react SPA connected to Angolan backend using gin router with goth.
As this is the first time working on a frontend app, im wondering what is the best approach to handle authentication.
shall i use the frontend app to authenticate against any provider and then use goth to verify the tokens? Or let goth handle the authentication and provide to the frontend with the tokens.
thanks in advance
The text was updated successfully, but these errors were encountered:
I just finished implementing something similar a few weeks ago. Basically, you have the frontend call the backend to start the authentication. After that, you collect the token and continue from there as usual on the backend. The last step is to redirect from the backend to the frontend with a JWT.
The user clicks button on frontend
Button navigates to the backend let's say /api/v1/auth/google
The user does the normal process
Google in this case redirects to /api/v1/auth/google/callback
You then store the Google token or do whatever you need to with it.
Finally redirect back the frontend /auth/callback?token=JWT_TOKEN_STRING
The frontend stores the token as a cookie or something and redirects the user to the desired location.
There are other ways to do this, but I did this for my implementation.
Hi there!
I’m working on an application which is composed by a frontend react SPA connected to Angolan backend using gin router with goth.
As this is the first time working on a frontend app, im wondering what is the best approach to handle authentication.
shall i use the frontend app to authenticate against any provider and then use goth to verify the tokens? Or let goth handle the authentication and provide to the frontend with the tokens.
thanks in advance
The text was updated successfully, but these errors were encountered: