【发布时间】:2020-03-26 23:16:52
【问题描述】:
我有一个使用OAuth2Authenticator 的登录页面,我想加载更改密码页面。
加载更改密码页面时,我被重定向到登录页面,因为在 Web 视图的新实例上我还没有登录。 所以我需要在打开更改密码页面之前使用令牌调用登录,但我不知道如何在打开 Web 视图的新实例时传递令牌。到目前为止,这是我的一些代码:
_authenticator = new OAuth2Authenticator(
clientId: appSetting["clientId"],
clientSecret: null,
scope: appSetting["scope"],
authorizeUrl: new Uri(appSetting["authorizeUrl"]),
redirectUrl: new Uri($"{appSetting["redirectUrl"]}://oauthredirect"),
accessTokenUrl: new Uri(appSetting["accessTokenUrl"]),
isUsingNativeUI: false,
pkceSupport: _pkceSupport)
{
ShouldEncounterOnPageLoading = true,
ClearCookiesBeforeLogin = true
};
_authenticator.Completed += OnAuthCompleted;
_authenticator.Error += OnAuthError;
OAuthAuthenticatorHelper.AuthenticationState = _authenticator;
var presenter = new OAuthLoginPresenter();
presenter.Login(_authenticator);
【问题讨论】:
-
如何打开修改密码页面?你能发布那个代码吗?
-
嗨,史密斯,我用 await Launcher.OpenAsync 打开我的页面
标签: xamarin xamarin.forms xamarin.auth