omniauth / omniauth-oauth2

An abstract OAuth2 strategy for OmniAuth.
MIT License
502 stars 304 forks source link

NoMethodError (undefined method `expired?' for nil:NilClass) #160

Open aarthi-mallow opened 2 years ago

aarthi-mallow commented 2 years ago
Screen Shot 2022-08-19 at 5 47 27 PM

NoMethodError (undefined method `expired?' for nil:NilClass) in V1.7.3. Works fine in older versions.

espen commented 2 years ago

This could be the same as this: https://github.com/stevenkaras/omniauth-mailchimp/pull/8

disaacs-sm commented 1 year ago

Was this ever resolved? I don't see it as being related to https://github.com/stevenkaras/omniauth-mailchimp/pull/8, because that issue involves the refresh token not be set, not the access token.

We are seeing exactly the same issue with Slack. Reverting to v1.7.2 fixes the issue.

Timrael commented 1 year ago

Has it been fixed? I face the same issue

BobbyMcWho commented 1 year ago

PRs are welcome

anupama-kumari commented 1 year ago

Can i work on this?

Saoma1 commented 1 year ago

Make sure that you are building your link correctly. I was seeing the same error, undefined method 'expired?' for nil:NilClass until I fixed my link_to url

route:
get 'auth/google_oauth2/callback', to: 'omniauth_callbacks#create'

wrong link:

view:
 <%= link_to "Sign in with Google", '/auth/google_oauth2/callback', method: :post, data: {turbo: false} %>

correct link:

view:
 <%= link_to "Sign in with Google", '/auth/google_oauth2', method: :post, data: {turbo: false} %>