【发布时间】:2021-06-22 11:37:23
【问题描述】:
我正在尝试在我的 Xamarin 应用程序中实现自定义 OAuth 登录。
单击登录按钮时,我正在从浏览器中访问 OAuth API。
它正在重定向到我的自定义 OAuth 身份验证页面,并在初始身份验证后从我的域页面的 auth.html 的 URL 中发送一个身份验证代码。我需要阅读该 URL 并进一步处理。
我在按钮中的代码点击:
var apiEndpoint = "https://auth.example.com/oauth2/authorize?response_type=code&client_id=myclientid&redirect_uri=https://example.com/apps/auth.html&state=STATE";
await Browser.OpenAsync("apiEndpoint", BrowserLaunchMode.SystemPreferred);
当从我的域重定向 uri 返回时,我需要从 URL 中读取代码,如下所示:
https://orion.lexmark.com/winapps/auth.html?code=12358123-2200-4ga6-a806-8f60f5636ac8&state=STATE
我对 xamarin 世界很陌生,对此有任何帮助。
【问题讨论】:
标签: xamarin xamarin.forms oauth-2.0 xamarin.android mobile-browser