Mastering Google OAuth in React and Golang | Complete Tutorial with Implicit and Auth Code Flow

Поділитися
Вставка
  • Опубліковано 28 жов 2024

КОМЕНТАРІ • 10

  • @daphenomenalz4100
    @daphenomenalz4100 4 місяці тому +1

    pls upload the video for refresh token too, this was so helpful.Thank you so much

    • @EfficientDevJourney
      @EfficientDevJourney  4 місяці тому

      Happy to help you and thanks for your input I will make the video once I get time. Happy learning 🎈😁

  • @goligoo501
    @goligoo501 5 місяців тому

    Do the explicit one to although you explained in a very good way just to complete the implicit and explicit videos please make another one too

  • @prashlovessamosa
    @prashlovessamosa 5 місяців тому

    Thanks

  • @prashanna8784
    @prashanna8784 5 місяців тому

    bro , why am i getting error redirect uri mismatch, in redirect uri we need to mention the route of backend or frontend

    • @EfficientDevJourney
      @EfficientDevJourney  5 місяців тому

      We have to mention the frontend url

    • @prashanna8784
      @prashanna8784 5 місяців тому

      @@EfficientDevJourney why it shouldnt be backend?

    • @EfficientDevJourney
      @EfficientDevJourney  5 місяців тому

      Actually it can be any but if you have it to be your backend it would be tricky to handle. So when Google responds with successful authorisation it sends us back a redirect response(HTTP redirect response). This redirect response will contain the redirect url(what we have given in the cloud console along with some query parameters such as the token). Now when the browser reads this redirect response it's gonna load that into the browser url and reload the page. Now all this logic has been handled for us in the react Google oauth package itself. It extracts the token from the query parameters and gives us back in the form of callback function. So the flow diagram is like this
      If frontend redirect url
      Browser -> Google -> browser -- redirects to frontend page with token(using js we can get the token -- this part is handled by the react package)
      If backend redirect url
      Browser -> Google -> browser -- now browser will make a GET request to your backend server with those query parameters.
      In both the cases the response will come back to the browser since only the browser made the HTTP request. Then the browser makes the decision to either show the frontend page or make a GET call to backend
      It's better to use the frontend url because it will show the UI to the user.
      If you are interested in trying with the backend redirect url, it would be a good Learning for you if you do some research on how to do it and also use the insights I have given above. It would be really fruitful. One small tip you should do without using any package on the frontend and backend remains the same. Happy learning.😊😊

    • @EfficientDevJourney
      @EfficientDevJourney  5 місяців тому

      I didn't mean to strike out anything but UA-cam did some formatting to my text. Just read the text as it is.