Authsub authentication with the GAPI code for Google Analytics API

882 Views Asked by At

I'm building an application that needs to authenticate users using Authsub. I have the authsub token already stored as $sessiontoken

I want to use this with the Google Analytics PHP interface (GAPI) but it only provides support for hard coded username and password:

`define('ga_email','[email protected]');

define('ga_password','removed');

define('ga_profile_id','removed');

require 'gapi.class.php';

$ga = new gapi(ga_email,ga_password);`

How can I use my authsub token here instead?

1

There are 1 best solutions below

0
Ewan Heming On BEST ANSWER

The token can be passed as an optional parameter on the end of the constructor. Just use null for the username and password then your auth token:

$ga = new gapi(null, null, $authToken);