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 Microsoft device code example with tenant id #222

Merged
merged 1 commit into from
Jun 15, 2023

Conversation

LorenzoLeonardo
Copy link
Contributor

To make it more understandable for Microsoft Azure endpoint users, an endpoint with tenant is added and edited the existing example as common user.

"https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize".to_string(),
)?,
Some(TokenUrl::new(
"https://login.microsoftonline.com/{tenant}/v2.0/oauth2/token".to_string(),
Copy link
Owner

Choose a reason for hiding this comment

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

shouldn't this be {tenant}/oauth2/v2.0/token?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will change it. Thanks for finding it :)

Copy link
Owner

Choose a reason for hiding this comment

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

this is the same issue @randomairborne fixed in #220 for the common case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ramosbugs ohh, I already changed that in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ramosbugs ok you can merge it, I will just do a rebase

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ramosbugs rebase done

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let device_auth_url = DeviceAuthorizationUrl::new(
"https://login.microsoftonline.com/{tenant}/oauth2/v2.0/devicecode".to_string(),
Copy link
Owner

Choose a reason for hiding this comment

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

to make it clear to users that this needs to be substituted for their tenant, I'd suggest defining a TENANT_ID global at the top, and then using the format! macro here to automatically fill it in so that they only have to update it in one place at the top. and then also a comment next to that global instructing them to do so, maybe with a link for where they can find that tenant ID

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@LorenzoLeonardo LorenzoLeonardo force-pushed the MS-Azure-Tenant-Example branch 3 times, most recently from 2a41e25 to 72cd0cd Compare June 15, 2023 02:04
To make it more understandable for Microsoft Azure endpoint users,
an endpoint with tenant is added and edited the existing
example as common user.
@LorenzoLeonardo LorenzoLeonardo force-pushed the MS-Azure-Tenant-Example branch from 72cd0cd to 977442a Compare June 15, 2023 02:10
@ramosbugs ramosbugs merged commit 5f4c288 into ramosbugs:main Jun 15, 2023
@ramosbugs
Copy link
Owner

Thanks!

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.

2 participants