huserben / TfsExtensions

Extensions for TFS 2015+ such as custom Widgets (require TFS 2017) and Build Tasks
MIT License
45 stars 22 forks source link

No valid OAuth token provided. Please check that you have the OAuth Token Access allowed for your builds. #166

Closed tophallen closed 3 years ago

tophallen commented 3 years ago

We started getting this error for every build trigger around the time the most recent (3.1.0) update was pushed out.

We have OAuth token enabled for the agent/job, and we left the access token blank so that it would try to get System.AccessToken. It's a little tough to tell from the PRs - but it does seem like the most recent change changes how that token is being retrieved.

Best I can see is the only change happened here in #139

We are using Azure DevOps Services and our agents are running 2.157.2 on Windows Server.

Seems like it might make sense to fall back on the old method of getting the access token, and then fail after that.

huserben commented 3 years ago

Hmm seems like this change might have broken this, somehow slipped through my testing. I'll try to revert this and push a fix asap.

tophallen commented 3 years ago

Awesome, thanks! Honestly not sure why that change doesn't work - I feel like it should based on the MS documentation...

mwisebaker commented 3 years ago

Thanks!

I deleted my comment because it turns out that it broke under 2.* too with a slightly different error: Authentication with TFS Server failed. Please check your settings.

Have it working with a PAT now but I’ll keep my eye open.

Michael D. Wisebaker Senior Software Engineer REC Technology Mailcode: KS-01-11-0501 Phone: 913/317-4566

"If it's not unit tested, it's broken." Pragmatic Programming Tipshttps://pragprog.com/tips/ [cid:image001.png@01D70F77.FDA3BC10]

From: Benj Huser notifications@github.com Sent: Tuesday, March 02, 2021 3:21 PM To: huserben/TfsExtensions TfsExtensions@noreply.github.com Cc: Wisebaker, Michael D Michael_D_Wisebaker@KeyBank.com; Comment comment@noreply.github.com Subject: Re: [huserben/TfsExtensions] No valid OAuth token provided. Please check that you have the OAuth Token Access allowed for your builds. (#166)

WARNING: This email originated externally. Exercise caution. Think before clicking links or opening attachments.

Hmm seems like this change might have broken this, somehow slipped through my testing. I'll try to revert this and push a fix asap.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/huserben/TfsExtensions/issues/166*issuecomment-789224777__;Iw!!LteP8qmF6ok6!ZZgnyDYRUA3EHPxlMFC0b2oh4wrM1iVjZlIjXfVkQ1dUycDGFEKoUNXRVPl6HPQ$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/ALBU5BWNDVHTNGUK7XPOUM3TBVJFFANCNFSM4YPX5UVA__;!!LteP8qmF6ok6!ZZgnyDYRUA3EHPxlMFC0b2oh4wrM1iVjZlIjXfVkQ1dUycDGFEKoUNXRoU37SLU$.

This communication may contain privileged and/or confidential information. It is intended solely for the use of the addressee. If you are not the intended recipient, you are strictly prohibited from disclosing, copying, distributing or using any of this information. If you received this communication in error, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. This communication may contain nonpublic personal information about consumers subject to the restrictions of the Gramm-Leach-Bliley Act. You may not directly or indirectly reuse or redisclose such information for any purpose other than to provide the services for which you are receiving the information.

127 Public Square, Cleveland, OH 44114

If you prefer not to receive future e-mail offers for products or services from Key, send an email to mailto:DNERequests@key.com with 'No Promotional E-mails' in the SUBJECT line.

huserben commented 3 years ago

@tophallen

As a workaround, you can pass $(System.AccessToken) as a password when selecting OAuth.

tophallen commented 3 years ago

Yeah, that's what we are doing for now. Thanks.

huserben commented 3 years ago

167 should have fixed it, it seems the new verison of the task lib imported the values now as undefined instead of null/"".

Thus it didn't try to fetch the token in the first place.

A new version is published now, please let me know whether it helped. If not I fear you'll have to use the workaround till tomorrow as it's getting late here.

Sorry for the troubles I've created.

huserben commented 3 years ago

I updated my test builds now to not specify anything, updated the task to the last published versions and it works.

image

If it works for you as well @tophallen feel free to close the issue.

Thanks for making me aware so quickly, I think due to that you saved a lot of other people some trouble (as Europe is asleep now :-)). Sorry once more for the trouble I've caused, I hope it didn't derail your plans for today too much.

tophallen commented 3 years ago

I'll test it now and close if it is fixed - at least there is a work around. Thanks for working so quickly on this @huserben.

mwisebaker commented 3 years ago

That seems to have fixed it for my build.

[cid:image001.png@01D70F80.9ACA51E0]

Michael D. Wisebaker Senior Software Engineer REC Technology Mailcode: KS-01-11-0501 Phone: 913/317-4566

"If it's not unit tested, it's broken." Pragmatic Programming Tipshttps://pragprog.com/tips/ [cid:image004.png@01D70F80.9DED63D0]

From: Benj Huser notifications@github.com Sent: Tuesday, March 02, 2021 4:21 PM To: huserben/TfsExtensions TfsExtensions@noreply.github.com Cc: Wisebaker, Michael D Michael_D_Wisebaker@KeyBank.com; Comment comment@noreply.github.com Subject: Re: [huserben/TfsExtensions] No valid OAuth token provided. Please check that you have the OAuth Token Access allowed for your builds. (#166)

WARNING: This email originated externally. Exercise caution. Think before clicking links or opening attachments.

I updated my test builds now to not specify anything, updated the task to the last published versions and it works.

[image]https://urldefense.com/v3/__https:/user-images.githubusercontent.com/5486874/109722896-a273f880-7bad-11eb-9bec-a726d6280450.png__;!!LteP8qmF6ok6!YYcbb-Zdje7urVNuCJN3TIVTisLubd8UEbmSPQCcbVvYN5KHc9CDd_tpqADBntU$

If it works for you as well @tophallenhttps://urldefense.com/v3/__https:/github.com/tophallen__;!!LteP8qmF6ok6!YYcbb-Zdje7urVNuCJN3TIVTisLubd8UEbmSPQCcbVvYN5KHc9CDd_tpS0tn82E$ feel free to close the issue.

Thanks for making me aware so quickly, I think due to that you saved a lot of other people some trouble (as Europe is asleep now :-)). Sorry once more for the trouble I've caused, I hope it didn't derail your plans for today too much.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/huserben/TfsExtensions/issues/166*issuecomment-789261919__;Iw!!LteP8qmF6ok6!YYcbb-Zdje7urVNuCJN3TIVTisLubd8UEbmSPQCcbVvYN5KHc9CDd_tpxyS25gk$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/ALBU5BRE67E3KU23HCJNHJLTBVQEFANCNFSM4YPX5UVA__;!!LteP8qmF6ok6!YYcbb-Zdje7urVNuCJN3TIVTisLubd8UEbmSPQCcbVvYN5KHc9CDd_tpQRQ3qA4$.

This communication may contain privileged and/or confidential information. It is intended solely for the use of the addressee. If you are not the intended recipient, you are strictly prohibited from disclosing, copying, distributing or using any of this information. If you received this communication in error, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. This communication may contain nonpublic personal information about consumers subject to the restrictions of the Gramm-Leach-Bliley Act. You may not directly or indirectly reuse or redisclose such information for any purpose other than to provide the services for which you are receiving the information.

127 Public Square, Cleveland, OH 44114

If you prefer not to receive future e-mail offers for products or services from Key, send an email to mailto:DNERequests@key.com with 'No Promotional E-mails' in the SUBJECT line.

tophallen commented 3 years ago

Confirmed this has been fixed. Thanks for the quick work! Closing this issue.