adonisjs/ally

Access token expiration being set to NaN

hugomarisco opened this issue · 1 comments

According to the OAuth2 spec, the expiration field is optional in the access token response.

(Almost) all Oauth2 drivers include this line:
https://github.com/adonisjs/adonis-ally/blob/develop/src/Drivers/Facebook.js#L258

Making the token expiration part of the AllyUser being set to Number(undefined) === NaN where I'd expect it to be null.

I propose a fix either in the drivers or in the AllyUser class to make sure this field is null when not provided by the third party.

I'm happy to create a PR after a decision around where to include the guard.

@hugomarisco Yes, I believe the Drivers should make sure to set null and AllyUser can keep on working as it is now.