Search code examples
c#oauthuwpopenidopenid-connect

What is the callback uri for a UWP application using SSO/OpenID Connect?


I have a UWP application and I'm trying to configure it to work with SSO, specifically OpenID Connect and I need to specify a callback URI in the process.

My question is, what is the callback URI for a UWP application?

I know iOS does somethng like com.myapp.x:/callback, so what is the equivalent for a UWP application?


Solution

  • Since OpenID Connect is built on OAuth 2.0 I assume you're looking for the standard OAuth 2.0 callback URI for the app.

    WebAuthenticationBroker is the standard object to run the OAuth sequence from the UWP client side. See its docs for more info.

    The actual callback URI will look something like the following, where the long mostly numeric sequence is the app's Package SID:

    ms-app://S-1-15-2-2340892341-2340892341-2340892341-2340892341-2340892341-2340892341-2340892341
    

    You can find the Package SID in your app's page on the Windows Dev Center dashboard under App Management.App Identity or you can get the full URI programmatically from WebAuthenticationBroker.GetCurrentApplicationCallbackUri

    Since using an app specific callback URI is essentially the same pattern as iOS uses some OAuth providers (e.g. Google) set up UWP apps through the iOS workflow.