PHP Classes

Token validity

Recommend this page to a friend!

      PHP OAuth Library  >  PHP OAuth Library package blog  >  Learn with a PHP OAut...  >  All threads  >  Token validity  >  (Un) Subscribe thread alerts  
Subject:Token validity
Summary:Token valid if logged off the site?
Messages:3
Author:Sudd Dongre
Date:2016-09-01 18:23:07
 

  1. Token validity   Reply   Report abuse  
Picture of Sudd Dongre Sudd Dongre - 2016-09-01 18:23:07
Hi,

First of all, thanks for a great and useful classes library. It makes one of the most difficult and ever changing process manageable.

I am using the Instagram login of your library. I wanted to know if the token I get from the user login process is valid if the user logs off. I have not been able to find a clear answer on Instagram site.

In my application, the instagram user may want me to do a batch process to search for specific content from Instagram but logs off after they allows my app scope to search instagram on their behalf. I want to be able to perform instagram search api endpoint when they are not logged in.

Hope this makes sense, let me know if you have other questions.

If you can point me to an answer I will really appreciate it.

Thanks,
-Sudd.

  2. Re: Token validity   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2016-09-01 19:34:59 - In reply to message 1 from Sudd Dongre
The OAuth token has nothing to do whether the user is logged or not.

It may happen that the server may invalidate the OAuth token for many reasons.

I don't know about Instagram but you can try getting the token. Logout the user in Instagram and see if the OAuth still works.

Just keep in mind that by default the OAuth class uses PHP sessions to store obtained tokens. So if you want to perform actions when the user is not present, you need to use a sub-class to store tokens somewhere like a database.

You may want to take a a look at this article. The example is for Google offline access but it works for other APIs.

phpclasses.org/blog/package/7700/po ...

  3. Re: Token validity   Reply   Report abuse  
Picture of Sudd Dongre Sudd Dongre - 2016-09-01 19:40:39 - In reply to message 2 from Manuel Lemos
Thanks Manuel.

I will give it a try with Instagram.

Best,
-Sudd.