首页 > 解决方案 > 如何使用flutter_appauth注销?

问题描述

我需要在flutter中按下按钮从flutter_appauth注销;

这个包没有任何注销方法。

这是我的获取令牌代码:

appAuth.authorizeAndExchangeCode(AuthorizationTokenRequest(
                clientID, redirectUrl,
                discoveryUrl: discoveryUrl,
                scopes: scopes,
                clientSecret: clientSecret

标签: flutterauthenticationopenid-connect

解决方案


在那个包中,没有任何解决方案,但这个问题有两种解决方法:

  1. 这是您的浏览器,因此您可以清除浏览器的缓存:)

  2. 当您调用授权和交换代码的方法时,需要添加一个名为“promptValues”的附加参数和“登录”值。这样,每次登录时,缓存中都没有值,它总是要求新的登录。

做这个 :

final AuthorizationTokenResponse result =
    await appAuth.authorizeAndExchangeCode(
      AuthorizationTokenRequest(
        your_client_id,
        your_localhost,
        promptValues: ['login'],
        discoveryUrl:
        your_discovery_url,
        scopes: [your_scopes],
      ),
    );

推荐阅读