icoretech / omniauth-spotify

OmniAuth strategy for Spotify Web API
MIT License
65 stars 25 forks source link

Token refresh #4

Open richoakley opened 10 years ago

richoakley commented 10 years ago

Is there a way to handle refreshing tokens?

rigelstpierre commented 10 years ago

Also looking to do this.

rigelstpierre commented 9 years ago

I'll leave this here for anyone else who has trouble with the refresh token. https://gist.github.com/rigelstpierre/07d461911182e3cb3480 I used these on an app I wrote. I'm not sure how'd I go about adding it to the gem but here is how I used it. The spotify method was called from the user. I stored the refresh_token, auth_token and expires_at on the user table in the database. Worked pretty well for us once we got the BASE_64 encoding correct, hardest part really.

richoakley commented 9 years ago

Thanks for sharing this Rigel! Will see if I can find a way of building it into the gem and then pull-request it.

seanders commented 9 years ago

+1

JordWyatt commented 8 years ago

Any update on this?

masterkain commented 8 years ago

do we have any other example of an omniauth2 gem that includes token refresh? I'm not entirely sure it belongs to this gem's domain since everyone has a custom method for this.

Opinions about that are appreciated.

justinthiele commented 8 years ago

@rigelstpierre Thanks for posting your solution, worked perfectly! 🎉

gfauredumont commented 7 years ago

Looks like what your looking is done by RSpotify, a gem to request Spotify's API (including ouath methods for private data), has a way of doing this: from the readme:

The user's access token is automatically refreshed by RSpotify when needed

We're using omniauth-spotify because we already use Devise and omniauth-facebook on our project so it should integrate seamlessly...

Unfortunately, changing the callback_url in devise's configuration seems not implemented here :/

masterkain commented 7 years ago

I've yet to push the new gem on rubygems because I want people to try out the redirect issues they're having, can you try the current master in your Gemfile?

https://github.com/icoretech/omniauth-spotify/commit/158a324d0360efc2f8f3ad7b203ce4402606a620

gfauredumont commented 7 years ago

Hi !

Just tested it and IT WORKS ! I had seen this differences between omniauth-spotify and omniauth-facebook but I wasn't sure it was what caused my issues. Thank you !

So I for one would love to see that update go to RubyGems. How can we help ? I'm probably not as good as you are, but I can probably help anyway, right ?

masterkain commented 7 years ago

0.0.10 has been pushed to rubygems, thanks for testing!