omniauth-oauth2 icon indicating copy to clipboard operation
omniauth-oauth2 copied to clipboard

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

Open aarthi-mallow opened this issue 3 years ago • 6 comments

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.

aarthi-mallow avatar Aug 19 '22 14:08 aarthi-mallow

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

espen avatar Sep 05 '22 17:09 espen

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.

disaacs-sm avatar Dec 15 '22 12:12 disaacs-sm

Has it been fixed? I face the same issue

Timrael avatar Mar 22 '23 14:03 Timrael

PRs are welcome

BobbyMcWho avatar Mar 22 '23 14:03 BobbyMcWho

Can i work on this?

anupama-kumari avatar Mar 23 '23 08:03 anupama-kumari

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} %>

Saoma1 avatar May 19 '23 10:05 Saoma1