سؤال

I have the Google Glass Quick Start PHP project up and working correctly (finally), but each time I access (and login in) it continues to ask me for "Offline Access" in-spite of the fact that have given it this access permission in the past (it only asks for the other permissions once..but repeatedly asks for offline access).

Is this expected behavior or is it a bug (if its a bug, what's the fix?)

هل كانت مفيدة؟

المحلول

If I close my browser window, It usually asks me to allow offline access.

So to me, it's a normal behavior

نصائح أخرى

The reason that the Mirror API PHP Quick Start project continually asks for offline access permission is because it does not use cookies to maintain the userid after the first authorization.

Look at line 28 of index.php:

if (!isset($_SESSION['userid']) || get_credentials($_SESSION['userid']) == null) { header('Location: ' . $base_url . '/oauth2callback.php'); exit;

With the sample application unchanged, $_SESSION['userid'] will never be set because that value was not passed into the application via a cookie or any other facility.

You can modify the sample application though so that the userid is passed in because after the first authorization, you will know the value for that particular user.

It is up to you though to modify the script to use whatever method is fit for your application to be able to relate the person running the application in the browser to the google API userid that authorized it.

Hope this helps.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top