Skip to main content

getting internal error 500 while using google signup method [duplicate]

my _config.php

<?php

session_start();
require_once 'vendor/autoload.php';
$google_client = new Google_Client();
$google_client->setClientId('16194638744-qm9esnsemf65s3ghch246sprp7jimrcp.apps.googleusercontent.com');
$google_client->setClientSecret('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');
$google_client->setRedirectUri('http://localhost/houzz/partials/g-callback.php');

$google_client->addScope('email');
$google_client->addScope('profile');

?>

my g-callback.php

<?php

require_once "_config.php";

if(isset($_GET['code'])){
    $token = $google_client->fetchAccessTokenWithAuthCode($_GET['code']);   
    $_SESSION['access_token'] = $token;
}else if(isset($_SESSION['access_token'])){
    $google_client->setAccessToken($_SESSION['access_token']);
}else{
    header('Location: localhost/houzz/partials/_otp.php');
    exit();
}

$Oauth = new Google_Service_Oauth2($google_client);
$userData = $Oauth->userinfo_v2_me->get();
$_SESSION['id'] = $userData['id'];
$_SESSION['email'] = $userData['email'];
$_SESSION['gender'] = $userData['gender'];
$$_SESSION['picture'] = $userData['picture'];
$_SESSION['familyName'] = $userData['familyName'];
$_SESSION['givenName'] = $userData['givenName'];

header('Location : ../index.php');


?>

my _otp.php where i have google sign up button and some other things

<?php


require_once "_config.php";


$loginUrl = $google_client->createAuthUrl();

?>






<!doctype html>
<html lang="en">

<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">


    <style>
    .form-Box {
        width: 50vh;
        /* display: flex; */
        position: relative;
        top: 30%;
        left: 5%;
        /* height: 100%; */
        width: 50%;
        align-items: center;
        margin: auto;
        justify-content: center;

    }

    .container {
        /* background-color: #43ba81; */
        height: 100vh;
    }

    body {
        background-color: rgba(33, 37, 41, 1);
        color: white;
    }



    .login-with-google-btn {
        transition: background-color .3s, box-shadow .3s;

        padding: 12px 16px 12px 42px;
        border: none;
        border-radius: 3px;
        box-shadow: 0 -1px 0 rgba(0, 0, 0, .04), 0 1px 1px rgba(0, 0, 0, .25);

        color: #757575;
        font-size: 14px;
        font-weight: 500;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;

        background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNMTcuNiA5LjJsLS4xLTEuOEg5djMuNGg0LjhDMTMuNiAxMiAxMyAxMyAxMiAxMy42djIuMmgzYTguOCA4LjggMCAwIDAgMi42LTYuNnoiIGZpbGw9IiM0Mjg1RjQiIGZpbGwtcnVsZT0ibm9uemVybyIvPjxwYXRoIGQ9Ik05IDE4YzIuNCAwIDQuNS0uOCA2LTIuMmwtMy0yLjJhNS40IDUuNCAwIDAgMS04LTIuOUgxVjEzYTkgOSAwIDAgMCA4IDV6IiBmaWxsPSIjMzRBODUzIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48cGF0aCBkPSJNNCAxMC43YTUuNCA1LjQgMCAwIDEgMC0zLjRWNUgxYTkgOSAwIDAgMCAwIDhsMy0yLjN6IiBmaWxsPSIjRkJCQzA1IiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48cGF0aCBkPSJNOSAzLjZjMS4zIDAgMi41LjQgMy40IDEuM0wxNSAyLjNBOSA5IDAgMCAwIDEgNWwzIDIuNGE1LjQgNS40IDAgMCAxIDUtMy43eiIgZmlsbD0iI0VBNDMzNSIgZmlsbC1ydWxlPSJub256ZXJvIi8+PHBhdGggZD0iTTAgMGgxOHYxOEgweiIvPjwvZz48L3N2Zz4=);
        background-color: white;
        background-repeat: no-repeat;
        background-position: 12px 11px;
    }

    .login-with-google-btn:hover {
        background-color: grey;
        color: white;
    }




    @media screen and (max-width:950px) and (min-width:300px) {
        .form-Box {
            width: 100%;
        }



    }
    </style>

    <title>HOUZZ-Modern Way for living </title>
    <link rel="icon" href="../_utilityimages/title.svg" type="image/x-icon">
</head>

<body>



    <div class="container">

        <h2 style="text-decoration:underline; text-align: center; position:relative; top:20%;">WELCOME TO HOUZZ</h2>


        <div class="form-Box">



            <!-- <span><img id="googleicon" src="../_utilityimages/googleicon.svg" alt=""></span> -->
            <!-- Sign Up With GOOGLE -->
            <!-- <form action="_otp.php" method="POST">

                <button type="submit" style="width:80%;" class="btn login-with-google-btn">
                    Sign in with Google
                </button>
            </form> -->
            <form>

                <button type="button" style="width:80%;" onclick="window.location='<?php echo $loginUrl; ?>'"
                    name="google" class="btn login-with-google-btn">
                    Sign in with Google
                </button>

            </form>
            <h3 class="or">OR</h3>

            <form action="_otp.php" method="POST">
                <br>
                <span class="heading"><em>Enter Your Name</em></span>
                <br>
                <br>
                <div class="input-group mb-3 inputBox" style="width: 80%;">


                    <input type="text" name="name" class="form-control" placeholder="Enter Your Name">
                </div>
                <span class="heading"><em>Enter Your Mobile Number</em></span>
                <br>
                <br>

                <div class="input-group mb-3 inputBox" style="width: 80%;">
                    <span class="input-group-text" id="basic-addon1">+91</span>
                    <input type="text" name="mobile" class="form-control" placeholder="Enter Your Mobile Number"
                        aria-label="Username" aria-describedby="basic-addon1">
                </div>
                <button type="submit" name="sendOtp" class="btn btn-primary">Send OTP</button>
                <br>
                <br>
                <span class="heading">Enter The OTP sent to your Mobile Number</span>
                <br>
                <br>
                <div class="input-group mb3 inputBox" style="width: 80%;">
                    <input type="text" name="verify" class="form-control" placeholder="Enter sent OTP"
                        aria-label="Username" aria-describedby="basic-addon1">
                </div>
                <br>
                <button type="submit" name="verifyOtp" class="btn btn-primary">Verify OTP</button>
            </form>
        </div>
    </div>






    <!-- Optional JavaScript; choose one of the two! -->

    <!-- Option 1: Bootstrap Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
        integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous">
    </script>


    <!-- Option 2: Separate Popper and Bootstrap JS -->
    <!--
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.10.2/dist/umd/popper.min.js" integrity="sha384-7+zCNj/IqJ95wo16oMtfsKbZ9ccEh31eOz1HGyDuCQ6wgnyJNSYdrPa03rtR1zdB" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.min.js" integrity="sha384-QJHtvGhmr9XOIpI6YVutG+2QOK9T+ZnN4kzFN1RtK3zEFEIsxhlmWl5/YESvpZ13" crossorigin="anonymous"></script>
    -->
</body>

</html>

I am trying to include google signup method in y website and i am getting error lik this :-Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at postmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Apache/2.4.52 (Win64) OpenSSL/1.1.1m PHP/7.4.27 Server at localhost Port 80 This error is coming when i am selecting any mail from a popper that is appearing on clicking the signup button . kindly help me out of this in a beginer friendly way



source https://stackoverflow.com/questions/70510840/getting-internal-error-500-while-using-google-signup-method

Comments

Popular posts from this blog

Prop `className` did not match in next js app

I have written a sample code ( Github Link here ). this is a simple next js app, but giving me error when I refresh the page. This seems to be the common problem and I tried the fix provided in the internet but does not seem to fix my issue. The error is Warning: Prop className did not match. Server: "MuiBox-root MuiBox-root-1" Client: "MuiBox-root MuiBox-root-2". Did changes for _document.js, modified _app.js as mentioned in official website and solutions in stackoverflow. but nothing seems to work. Could someone take a look and help me whats wrong with the code? Via Active questions tagged javascript - Stack Overflow https://ift.tt/2FdjaAW

How to show number of registered users in Laravel based on usertype?

i'm trying to display data from the database in the admin dashboard i used this: <?php use Illuminate\Support\Facades\DB; $users = DB::table('users')->count(); echo $users; ?> and i have successfully get the correct data from the database but what if i want to display a specific data for example in this user table there is "usertype" that specify if the user is normal user or admin i want to user the same code above but to display a specific usertype i tried this: <?php use Illuminate\Support\Facades\DB; $users = DB::table('users')->count()->WHERE usertype =admin; echo $users; ?> but it didn't work, what am i doing wrong? source https://stackoverflow.com/questions/68199726/how-to-show-number-of-registered-users-in-laravel-based-on-usertype

Why is my reports service not connecting?

I am trying to pull some data from a Postgres database using Node.js and node-postures but I can't figure out why my service isn't connecting. my routes/index.js file: const express = require('express'); const router = express.Router(); const ordersCountController = require('../controllers/ordersCountController'); const ordersController = require('../controllers/ordersController'); const weeklyReportsController = require('../controllers/weeklyReportsController'); router.get('/orders_count', ordersCountController); router.get('/orders', ordersController); router.get('/weekly_reports', weeklyReportsController); module.exports = router; My controllers/weeklyReportsController.js file: const weeklyReportsService = require('../services/weeklyReportsService'); const weeklyReportsController = async (req, res) => { try { const data = await weeklyReportsService; res.json({data}) console