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

Support for Refresh Token #10

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

pmusyoki
Copy link

@pmusyoki pmusyoki commented Jun 5, 2020

Refreshing tokens is now supported. See docs fro more information.

@swelham
Copy link
Owner

swelham commented Jun 9, 2020

Thanks for the PR 👍

There looks to be quite a lot of change unrelated to the feature you are adding. From what I can tell we shouldn't need to update any dependencies or the mix.exs file to get refresh tokens working.

Would you mind reverting those changes and confirming the feature still works?

defp defaults(config) do
tenant_id = config[:tenant_id] || "common"

[
strategy: __MODULE__,
site: "https://graph.microsoft.com",
site: "https://login.microsoftonline.com/#{tenant_id}/oauth2/v2.0",
Copy link
Owner

Choose a reason for hiding this comment

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

I think https://graph.microsoft.com is the correct value for site as this describes the site we're authenticating to get access to. The https://login.microsoftonline.com/ URL is only used for carrying out the authentication.

Copy link
Author

Choose a reason for hiding this comment

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

Tokens are refreshed by submitted a POST request to /token of the endpoint, which is "https://login.microsoftonline.com/#{tenant_id}/oauth2/v2.0". The OUATH refresh strategy concats the site and token opts opts to derive the endpoint URI.

The "https://graph.microsoft.com" endpoint is for the GraphAPI itself after authentication.

authorize_url: "https://login.microsoftonline.com/#{tenant_id}/oauth2/v2.0/authorize",
token_url: "https://login.microsoftonline.com/#{tenant_id}/oauth2/v2.0/token",
token_url: "/token",
Copy link
Owner

Choose a reason for hiding this comment

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

I wasn't able to get authentication working when only using /token. Am I missing something here?

@ludwikbukowski
Copy link

Whats the status of this one?

@swelham
Copy link
Owner

swelham commented Mar 7, 2024

Happy to get this merged, just needs a rebase and confirmation around the url change.

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 this pull request may close these issues.

3 participants