Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Omniauth-oauth2 v.1.8.0 Causes "undefined method `expired?'" #22

Open
kevinneub opened this issue Sep 7, 2022 · 5 comments · May be fixed by #23
Open

Omniauth-oauth2 v.1.8.0 Causes "undefined method `expired?'" #22

kevinneub opened this issue Sep 7, 2022 · 5 comments · May be fixed by #23

Comments

@kevinneub
Copy link

I had the following in my Gemfile...
gem 'omniauth-oauth2', '~> 1.7'

After a bundle update omniauth-oauth2 went from v.1.7.3 -> 1.8.0

That caused errors when authenticating with Slack as follows...
D, [2022-09-07T18:08:29.046543 #42987] DEBUG -- omniauth: (slack_chiirp) Callback phase initiated.
OAuth2::Client#get_token argument extract_access_token will be removed in oauth2 v3. Refactor to use access_token_class on #initialize.
D, [2022-09-07T18:08:29.047586 #42987] DEBUG -- omniauth: (slack) API request '[:post, "https://slack.com/api/oauth.v2.access"]'.
E, [2022-09-07T18:08:29.200274 #42987] ERROR -- omniauth: (slack_chiirp) Authentication failure! undefined method expired?' for nil:NilClass self.access_token = access_token.refresh! if access_token.expired? ^^^^^^^^^: NoMethodError, undefined method expired?' for nil:NilClass
self.access_token = access_token.refresh! if access_token.expired?

Let me know if any other info is needed.

@marcbest
Copy link

@kevinneub did you manage to resolve this?

@kevinneub
Copy link
Author

I reverted back to 1.7. I was not able to determine what was causing it. I understand the oauth2 process but I haven't spent the time to get a good handle on the omniauth gems.

@ozmar-salesloft ozmar-salesloft linked a pull request Sep 30, 2022 that will close this issue
@marcbest
Copy link

The linked PR fixes this for me, thanks @ozmar-salesloft

@K-S-A
Copy link

K-S-A commented May 20, 2023

Here is a fork with a bunch of the updates for the ruby 3.x and the latest version of the oauth-xx/oauth2:

https://github.com/riter-co/omniauth-slack

@aka-nez
Copy link

aka-nez commented Oct 27, 2023

@K-S-A big thanks! You saved me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants