Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8980299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:03:24+00:00 2026-06-15T20:03:24+00:00

I have a file called TasksLogin.php which lets me login session_start(); require_once ‘google-api-php-client/src/Google_Client.php’; require_once

  • 0

I have a file called TasksLogin.php which lets me login

session_start();
require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/src/contrib/Google_TasksService.php';
$client = new Google_Client();
$client->setClientId('xxxxx.apps.googleusercontent.com');
$client->setClientSecret('xxxxxxxxx');
$client->setRedirectUri('http://xxxxxxxxx/Tasks/TaskVis.html');
$client->setApplicationName("TasksForMike");
$tasksService = new Google_TasksService($client);

if (isset($_REQUEST['logout'])) {
  unset($_SESSION['token']);
}

if (isset($_SESSION['token'])) {
  $client->setAccessToken($_SESSION['token']);

} else {
  $client->setAccessToken($client->authenticate($_GET['code']));
  $_SESSION['token'] = $client->getAccessToken();

}

if (isset($_GET['code'])) {
  $redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
  header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL));
}
?>
<?php $_SESSION['token'] = $client->getAccessToken(); ?>

That seems to work because it redirects to TaskVis.php
But in TasksVis.php I call:

$(document).ready(function() {
  $.get("tasks.php", function(data){
var json = data;
});
 });

which is the php file that gets the tasks and packages them up in a json object.
but in tasks.php, I have this code that crashes:

session_start();
require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/src/contrib/Google_TasksService.php';
$client = new Google_Client();
$client->setClientId('xxxxxx.apps.googleusercontent.com');
$client->setClientSecret('xxxxxxxxxxxxxxx');
$client->setRedirectUri('http://xxxxxxxxx/Tasks/TaskVis.html');
$client->setApplicationName("TasksForMike");
$tasksService = new Google_TasksService($client);

if (isset($_REQUEST['logout'])) 
{
  unset($_SESSION['token']);
}
 if (isset($_GET['code'])) {
  $client->authenticate($_GET['code']);
  echo "hh";
  die();
  $_SESSION['token'] = $client->getAccessToken();
  header('Location: http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);

}
?>

the “die” never runs and I get a 500 server error. Since the code is in the query string, why is the $client->authenticate($_GET['code']); failing ? I am trying to seperate the data code from the rendering.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T20:03:25+00:00Added an answer on June 15, 2026 at 8:03 pm

    I don’t think there’s any ‘code’ in the query string. Your ‘code’ value is lost when you redirect to TaskVis.php and don’t include it in the redirect. Then, in that file, you’re calling tasks.php here…

    $.get("tasks.php", function(data){
    

    …so if there were any _GET values, they would be included in the call:

    $.get("tasks.php?code=xxxx", function(data){
    

    I’d be interested in knowing the nature of the 500 error also. Have you tried calling this while viewing the console in Firebug?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a file called src.js which has all the scripts for my html
I have a file called filecontent.txt which includes some php code. And i have
I have a file called layout.php which contains <?php $arrLayout = array( section1 =>
I have a file called form.php which is just a regular html file with
I have a file called video_2.m4v on my computer, which is being used by
I have a file called header.php that I am including on every page on
I have a file called webpart.cs which is called by one of my masterpages
I have a file called 34.php?session=2534464a39a2c97cb7113689726a4e52 in my /var/www/html folder but I can't view
I have a file called inp.txt which lists 3 directory names #!/bin/sh while read
Say I have a file called hello.txt which contains Hello World!. If I wanted

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.