I'm pretty new to Azure/OAuth2 so apologies if this is a simple problem. My head's spinning though and I'd appreciate some pointers.
I'm developing a command line utility for use in a high performance compute cluster. This utility needs to access a REST API which is secured using Azure's OAuth2 implementation.
I'm struggling to get my head around how my client utility should be getting auth codes. My intended flow looks like this...
I'm falling over between steps 5 and 6. I'm seeing "No reply address is registered for the application" in the browser after providing credentials. I think Azure wants me to specify a reply address in the app registration so it can validate the reply address in the client-generated URL. The problem is, I can't feasibly give one! Here's why...
Is what I'm trying to achieve even possible using Azure? I feel like my flow is either wrong or my use-case unsupported. I've read a bit about a 'device flow' in the OAuth2 spec which looks like it may be useful. However, I haven't seen any indication that Azure supports this.
My next step would be to route all code replies via a proxy with a known, static, URI. This feels like more work than I ought to be doing to get this working though, so wanted to run this past the experts first ;)
Thoughts appreciated!
Thanks,
Mark.
It kinda sounds like a case for OAuth Device flow: https://joonasw.net/view/device-code-flow
The flow - a helicopter view
- App makes HTTP POST to the device code endpoint
- Gets response with:
- User code
- Device code
- Verification URL
- Expiry time
- Polling interval
- Friendly message
- Shows message to user so they can open a browser and go to the verification URL
- App starts polling the token endpoint at the defined polling interval, waits for a 200 OK
- User opens browser, goes to verification URL, enters the user code
- User signs in with their account
- App receives 200 OK with:
- Access token
- Refresh token
- Id token
My blog article has detailed HTTP requests you need to make, but the main point of it is to allow authentication on browserless devices.