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

Add method to refresh a token using a refresh_token #313

Merged
merged 8 commits into from
Nov 9, 2018

Conversation

modeswitch
Copy link
Contributor

This uses code from here, with a couple of fixes required to make it work.

Fixes #240

@modeswitch
Copy link
Contributor Author

I'm currently using a modified version of this library to work around #240. I'd love it we could get this patch merged and published so that I can use the upstream code again.

Give me a shout if you want changes and I'll respond ASAP.

luisrudge
luisrudge previously approved these changes Nov 8, 2018
src/auth/index.js Outdated Show resolved Hide resolved
src/auth/index.js Outdated Show resolved Hide resolved
src/auth/index.js Outdated Show resolved Hide resolved
Co-Authored-By: modeswitch <github@ack.modeswitch.org>
Co-Authored-By: modeswitch <github@ack.modeswitch.org>
@modeswitch
Copy link
Contributor Author

@luisrudge Changes applied to the copy-pasted comments.

* refresh_token: '{REFRESH_TOKEN}',
* };
*
* auth0.refresh(data, function (err, userData) {
Copy link
Contributor

@luisrudge luisrudge Nov 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry, I should've catched this before, but let's change this to refreshToken. Thanks 🎉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries. Updated now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry again 😢 I was talking about the method name 😬 from refresh to refreshToken. The refresh_token parameter has to remain the same so the API understands it.

@modeswitch
Copy link
Contributor Author

@luisrudge Changed refresh_token to refreshToken and updated the PR.

@luisrudge
Copy link
Contributor

@modeswitch I updated the PR with the correct method name, but I noticed refresh tokens are not supported in OIDC flows. I'll talk internally with the team to make sure we should add that into the SDK.

@modeswitch
Copy link
Contributor Author

@luisrudge Ah sorry, I misunderstood your change request!

Do you mean that refresh tokens are not supported in OIDC flows in this library, but should be?

@luisrudge
Copy link
Contributor

I mean that you won't get a refresh_token if you're using an OIDC conformant application (which is the default).

image

We're moving to an oidc-only sdk in the future and, if that's really the case, doesn't make sense to add this method now to deprecate it in the near future.

@modeswitch
Copy link
Contributor Author

modeswitch commented Nov 9, 2018

One can still obtain a refresh token in an OIDC-conformant application, no?

Edit: I have OIDC-conformant enabled in my Auth0 application that I'm currently using with node-auth0 and I'm able to obtain refresh tokens without issue.

@luisrudge
Copy link
Contributor

@modeswitch I'm sorry 😬 I was only looking at the Implicit flow docs.

@luisrudge luisrudge merged commit db720e5 into auth0:master Nov 9, 2018
@luisrudge luisrudge changed the title Adds support for fetching an auth token using a refresh token Add method to refresh a token using a refresh_token Nov 9, 2018
@luisrudge
Copy link
Contributor

Next release should happen next week 🎉 Thanks for all the help and patience

@modeswitch
Copy link
Contributor Author

@luisrudge No worries! Thanks for getting this merged in. Also, thanks to @dancrumb for writing the original code!

@luisrudge luisrudge added this to the v2.14.0 milestone Nov 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a method for the refresh_token grant type
2 participants