Why did my access token expire?

Thanks for the suggestion @gruvin and the ping @Dave. It’s currently on the backlog and toward the top, after this hiring round we’ll knock this out.

2 Likes

Hi jgoggins,
When you’ll start to work to add the expiration date, maybe you can also add a function to send a reminder e-mail some days in advance. An unexpected expiration could be not very nice.
Thanks

Hi @accio , yes absolutely, thank you for the clarification. I just confirmed that an email reminder is in the spec. Will ping you when something ships related to this request.

2 Likes

I wholeheartedly agree with being able to set a longer expiration date for the access token.

I just built a web connected hot tub temperature controller for my father (being able to heat up the hot tub on the way home rocks!), but having to reset the access token saved on the phone client every 90 days will be troublesome for the non-technically inclined.

I know I could automate it, but am unsure of how to accomplish this through the SmartThings IDE without just generating a new token every time I parse a command…

Is there any way to use spark username and password credentials in lieu of an access token for http post commands?

Eagerly looking forward to new token settings,
Aric

Also just got burned by this. Project suddenly went unresponsive and a quick check of the logs showed the access token expiration error. I’d love the capability for a non-expiring token or an email reminder a few days before. Looking forward to an update here!

resurrecting this conversation...

have you implemented the expiry date on access tokens?

I couldn't find another thread with the answer.

1 Like

Heya @BulldogLowell,

I had my hands in the API quite a bit this last sprint, and I was searching for an opportunity to allow more customization of the access token expiration / token lifetime. I didn’t have a chance to sneak this in yet, but I’ll bump it up the priority list, it’s been a long time coming. :slight_smile: Lets say if not this sprint, then by the end of next sprint (by the end of Feb 2015).

Thanks!
David

2 Likes

That’s great David… I appreciate the update!

great stuff here…

1 Like

I’ve recently experienced a similar data logging outage due to an expired access token that I am using in a google doc script…
I didn’t realize it until 12 hours had passed. This topic started on March 18, 2014,
10 months ago. On May 23, a spark team member said: “We’ll be adding a lifespan type
parameter when creating and managing access tokens, so you can create a very long one
(20 years, etc) if you really want.” I feel this would be a great improvement, along with
a display of expiration date in the IDE and email notification. so @Dave can you provide
a status update on these much needed fixes ? Aside from this, and generally, I think you guys are doing a great job!

Thanks,
Joe

1 Like

Oh, sorry @Dave. Somehow your Feb 6th update post didn’t register with me. End of this month sounds great.

Thanks again.
Joe

1 Like

Saw some new docs branch but nothing is official here…

If you are interested to read some new materials: https://github.com/spark/docs/pull/298/files :wink:

1 Like

Did something change in the API, because this method used to work for me. but now I am getting an error when I try the same URL. I have tried with and without v1/ before the oath part of the URL:

https://api.spark.io/oauth/token -u spark:spark -d grant_type=password -d username=XXXXXXXXX -d password=YYYYYYY

I get this reply:

 {
   "ok": false,
    "error": "Not Found",
    "device_name": "turkey vampire captain pizza hobo"
 }

@beroe are you using curl to run the command?

In testing I am using curl, but in implementation, I was using python’s urllib2.urlretrieve

I am pretty sure both methods used to work…

Just tested and it works for me:

KENMBP:~ kennethlimcp$ curl https://api.spark.io/oauth/token -u spark:spark \
> -d grant_type=password -d username=kennethlimcp@.com -d password=xxx
{
  "token_type": "bearer",
  "access_token": "xxxx",
  "expires_in": 7776000,
  "refresh_token": "ce75d7ddea2ee35debfe6772a9b2350d197c39ee"
}KENMBP:~ kennethlimcp$ 

Interesting. I’ll keep poking around. Good to know that the v1 business I read about in another thread is a red herring. So we don’t have to specify a device, right? This is for all of them associated with our account?

Tried it and of course it worked this time.

I was putting quotes around the URL, so maybe that was causing the problem.

Thanks a lot for the reply.

1 Like

Hi Dave,

Did this ever happen? Is there now a way to set access tokens to NOT expire, or set the expiry time a loooot longer?

Thanks,
R

See: http://docs.particle.io/photon/api/#authentication-configure-when-your-token-expires

2 Likes

If you click the “reset token” button in the Web IDE, it will create one that doesn’t expire :smile:

2 Likes

@Moors7, a little more detail please? How exactly do you set an access token that does not expire?

I am developing hardware/software solutions for ARGHHH! CONSUMERS!!! Yes, the general non computer literate public. Seriously, I love em and have been producing products and supporting non-computer savvy people for years. But you have to respect certain boundaries to make money at it.

I sure don’t want tech calls, one star reviews and flaming blogs as a result of anything happening in the background that causes a customer’s product to “stop working”. It “stopped working” is a pretty detailed description from an upset customer. Talking a customer through an “expired token” (WTHeck :blush:) would not be pleasant.

So, this is my vote for a perpetual access token , or at least as long as the product will survive.

And as long as I’ve got your attention, it is also my vote to provide a paid cloud API for commercial products. I agree with @kennethlimcp that DIY community is better served with a free service, but those of us hoping to make some money by selling reliable products need to have a different level of reliability (no @bko I don’t want to build my own cloud) in a cloud service and I don’t mind paying for it.

:smile: