Friday, April 5, 2013

Google Docs Viewer requiring user to log-in to view document - Fix - Force signout of Google Account



If you get the following log-in into Google URL (call it status 
1209600) while trying to view a document using Google Doc Viewer of a local resource (NOT a resource hosted on Google Drive) and get the following error; 


https://accounts.google.com/SeviceLogin?service=wise&passive=1209600&continue=https://docs.google.com/viewer?url={urlencoded URL to your PDF doc }...

then your issue is you have not logged-off the Google universe or clear the cookie to view the file. 

I found this to be a particular issue for Internet Explorer 7. IE 8 -> 10 worked fine.  

To log-off Google-verse programmatically and flush credentials using the following before your Google Doc Viewer Iframe;  

<iframe id="google-signout" 
        src="https://www.google.com/accounts/Logout" 
        style="width: 1px; height: 1px; display: none;" 
       frameborder="0"></iframe>

<iframe id="google-signout" 
        src="https://www.google.com/accounts/Logout" 
        style="width: 1px; height: 1px; display: none;" 
       frameborder="0"></iframe>


2 comments: