Login with Google using PHP - Beginner Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ธ.ค. 2024

ความคิดเห็น •

  • @AnabelaPardinhaPires
    @AnabelaPardinhaPires ปีที่แล้ว +2

    Perfect!!!! Thank you so much... Just an update : in your line 29 we need to change it to " $gauth=new Google\Service\Oauth2($client);" that is how it wotks nowadays.

  • @thidasvinnath8017
    @thidasvinnath8017 9 หลายเดือนก่อน

    ay man this was super helpful any beginner could've followed along, other tutorials say that it's for beginners and assumes that you have composer but this is something else, cheers 🥂

    • @TheCodeCity
      @TheCodeCity  8 หลายเดือนก่อน +1

      You're welcome! glad it helped!

  • @saibademais
    @saibademais 2 ปีที่แล้ว

    Thank you. Congratulations from Brazil. I was trying with videos in my language and only now I get.

  • @masaan5356
    @masaan5356 ปีที่แล้ว

    Wow its really work. Thank you sir, you are very funny. 😂

  • @riyalpatel6290
    @riyalpatel6290 2 ปีที่แล้ว +1

    Fatal error: Uncaught Error: Class 'Google\Auth\OAuth2' not found

  • @bayusuharso
    @bayusuharso ปีที่แล้ว

    awesome tutorial! subscribed.

  • @freshcodeacademy
    @freshcodeacademy 11 หลายเดือนก่อน

    Thank you!👏

    • @TheCodeCity
      @TheCodeCity  11 หลายเดือนก่อน

      Glad it helped!

  • @korndev6862
    @korndev6862 3 ปีที่แล้ว

    thank you so much for this tutorial, it's very useful.

  • @dreamymarklyy4122
    @dreamymarklyy4122 2 ปีที่แล้ว

    why did I get this error :
    Authorization Error
    Error 400: invalid_request
    Invalid parameter value for approval_prompt: 'auto'' is not valid
    after clicking the 'login with Google' button?

  • @hounterke
    @hounterke 2 ปีที่แล้ว

    someone assit am getting saying must be type countable, please assit what might be the problem

  • @thapatlaor2463
    @thapatlaor2463 2 ปีที่แล้ว

    How do you solve the 403:Disallowed_useragent for iOS users? I'm using php

  • @fsudave87
    @fsudave87 3 ปีที่แล้ว +1

    Very thorough and to the point - thanks! I also appreciate the bugs you ran into - that's realistic coding! Thanks again for the great vid!

  • @RannLight
    @RannLight ปีที่แล้ว

    how to connect this sir into my website?

  • @ludo2604
    @ludo2604 2 ปีที่แล้ว

    hello, do you have an idea how resolve the error 500 ? i have this same error in localhost and production. before it s work now no . i search everywhere, it's annoying this problem.

    • @ludo2604
      @ludo2604 2 ปีที่แล้ว

      Failed to load resource: the server responded with a status of 500 ()

  • @abulalalalalaabulala4521
    @abulalalalalaabulala4521 3 ปีที่แล้ว

    What is new Google_Service_0auth? Is it self-defined? Or provided by google?

  • @coeniejvr
    @coeniejvr 2 ปีที่แล้ว

    code is working but when you refresh the page i get this error "Uncaught InvalidArgumentException: invalid json token"; The token change everytime when new login

  • @signbs38
    @signbs38 3 ปีที่แล้ว

    Hello sir can i use header to redirect users into my home page?

  • @nayerehchenari
    @nayerehchenari 3 ปีที่แล้ว +1

    That was a great tutorial thank you. However I keep getting error about count() method needs an array as parameter and it is in regard to this line: "$token = $client->fetchAccessTokenWithAuthCode($_GET['code']);" Would you be able to help me with this?

    • @hounterke
      @hounterke 2 ปีที่แล้ว

      someone help with this error

    • @nikunjsinghania465
      @nikunjsinghania465 2 ปีที่แล้ว

      update the composer

    • @mootjevines3555
      @mootjevines3555 ปีที่แล้ว

      You are probably running a too old version of PHP

  • @amadousambadiallo6468
    @amadousambadiallo6468 2 ปีที่แล้ว

    Hello sir , i can’t find Google_Client()
    Can you help me

  • @haksenguz
    @haksenguz 3 ปีที่แล้ว +2

    Thank you very much! It was a very useful tutorial. I was finally able to make Google Sign in to my website. I have a question sir. As I am new to PHP I did not how to make Google sign in on my hosted website. Iuploaded Google API library to my webserver and made Google sign in. It was difficult to do it, since it took long time to upload 30MB file to the server. In web development in commercial websites, when making Google sign in, do you also upload large file to server? Or it is done by other ways? I will be genuinely glad, if you answer me! Thank you!

    • @TheCodeCity
      @TheCodeCity  3 ปีที่แล้ว +2

      Deployment can be done in several ways, but in all of them you'll require google library set up in your project in the server. Whether you install it directly in the server or upload it from your local machine. Both are correct. And it should not take a long time to upload 30MB of files to the server.

    • @haksenguz
      @haksenguz 3 ปีที่แล้ว +1

      @@TheCodeCity Thank you so much!I appreciate your response!

  • @omercankaplan6001
    @omercankaplan6001 2 ปีที่แล้ว

    I appreciate it bro

  • @mohamedmaher4696
    @mohamedmaher4696 3 ปีที่แล้ว +1

    Hi iam using online host for my website
    How can i do it ?

    • @TheCodeCity
      @TheCodeCity  3 ปีที่แล้ว

      In redirect URL try adding the domain name of your website.

  • @orangkafir
    @orangkafir 3 ปีที่แล้ว +1

    could you share how to do it in cpanel shared hosting, please? also step by step like this, thank you.

    • @TheCodeCity
      @TheCodeCity  3 ปีที่แล้ว +1

      You just do it in your local machine, and upload the project to server. Nothing else is required.

    • @orangkafir
      @orangkafir 2 ปีที่แล้ว

      @@TheCodeCity thank you mate, so clear. it worked.

  • @prabaths
    @prabaths 2 ปีที่แล้ว

    Thank you

  • @rqdjndbduusheh4
    @rqdjndbduusheh4 3 ปีที่แล้ว +1

    Sir can i save to my database

    • @TheCodeCity
      @TheCodeCity  3 ปีที่แล้ว

      Yes, you can

    • @rqdjndbduusheh4
      @rqdjndbduusheh4 3 ปีที่แล้ว +1

      @@TheCodeCity thanks sir, is this secure 100%

  • @milanmalla3173
    @milanmalla3173 3 ปีที่แล้ว

    Is it process same for Facebook login too? Sorry if my question is stupid. I'm just beginning.

    • @TheCodeCity
      @TheCodeCity  3 ปีที่แล้ว

      Yes, the question indeed is stupid. No, it's a different process for Facebook

    • @milanmalla3173
      @milanmalla3173 3 ปีที่แล้ว +1

      @@TheCodeCity can you make a tutorial?

    • @TheCodeCity
      @TheCodeCity  3 ปีที่แล้ว

      You got it!

  • @dhyutinimmagadda7671
    @dhyutinimmagadda7671 3 ปีที่แล้ว

    this is amazingg...thanks

    • @TheCodeCity
      @TheCodeCity  3 ปีที่แล้ว

      You're welcome!

    • @jacksoncayson9242
      @jacksoncayson9242 3 ปีที่แล้ว

      a tip: you can watch series at flixzone. Me and my gf have been using it for watching all kinds of movies recently.

    • @chasearjun2744
      @chasearjun2744 3 ปีที่แล้ว

      @Jackson Cayson Yea, I've been using flixzone} for since december myself :)

  • @meghnathjani5956
    @meghnathjani5956 3 ปีที่แล้ว

    Getting ''403 Forbidden' error after login

    • @kevincrane97
      @kevincrane97 ปีที่แล้ว

      Same. Did you find a solution?

  • @pawanagarwal4513
    @pawanagarwal4513 2 ปีที่แล้ว

    can you tell me how to logout ???

    • @TheCodeCity
      @TheCodeCity  2 ปีที่แล้ว

      You can do: $google_client->revokeToken(); and destroy session and handle accordingly

  • @elbrenantonio81528
    @elbrenantonio81528 3 ปีที่แล้ว

    can u include logout

    • @MichealHolt
      @MichealHolt 3 ปีที่แล้ว

      You'd just have a button like the login "a" tag he made. Since logging in sets the "code" entry in GET, you can easily manipulate that by removing it from the current URL. Is the "if (isset...)" section, you'd do something like:
      echo "Log Out";
      Since the redirectURL is just the original one without the GET part, this should easily log you out.
      However, it's important to note: If you stored this information using something like POST or COOKIES (cookies being an insecure method), you also need to remove those as well. That would go under the "else" section. For example, if you stored the data in POST, you'd have the line:
      $_POST = array();

  • @muhammadnuraddin7818
    @muhammadnuraddin7818 3 ปีที่แล้ว

    so how to log out?

  • @boizdeeptry
    @boizdeeptry 3 ปีที่แล้ว

    Source Code pls :

    • @boizdeeptry
      @boizdeeptry 3 ปีที่แล้ว

      Error: Class 'Google_Client' not found

    • @TheCodeCity
      @TheCodeCity  3 ปีที่แล้ว

      @@boizdeeptry Did you set up the Google SDK properly, sorry unfortunately the source code is not available at the moment.

  • @souhailebenslimane4694
    @souhailebenslimane4694 2 ปีที่แล้ว

    hi sir, i got this warning i dont know what to do can you help me please
    Warning: require_once(C:\xampp\php\pear): Failed to open stream: Permission denied in C:\xampp\htdocs\vue\login.php on line 2
    Fatal error: Uncaught Error: Failed opening required '' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\vue\login.php:2 Stack trace: #0 {main} thrown in C:\xampp\htdocs\vue\login.php on line 2