Open richoakley opened 10 years ago
Also looking to do this.
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.
Thanks for sharing this Rigel! Will see if I can find a way of building it into the gem and then pull-request it.
+1
Any update on this?
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.
@rigelstpierre Thanks for posting your solution, worked perfectly! 🎉
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 :/
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
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 ?
0.0.10 has been pushed to rubygems, thanks for testing!
Is there a way to handle refreshing tokens?