Xamarin身份验证更改密码

时间:2019-12-02 10:46:16

标签: xamarin xamarin.forms xamarin.auth

我有一个使用OAuth2Authenticator的登录页面,我想加载更改密码页面。

在加载更改密码页面时,我被重定向到登录页面,因为在Web视图的新实例上,我尚未登录。 因此,在打开更改密码页面之前,我需要使用令牌调用login,但是我不知道在打开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);

1 个答案:

答案 0 :(得分:0)

一种方法是准备您的Web应用程序以通过查询字符串接收参数,然后在应用程序中调用通过viewstring传递的webview和要使用的参数