未从 Auth0.authorize() - PKCE 获取刷新令牌

Not getting a refresh token from Auth0.authorize() - PKCE

我在 Auth0 中有一个本机应用程序,使用 PKCE 流程。当我使用 Auth0.js 从我的 Ionic 应用程序调用 Auth0.authorize() 时,我得到了一个访问令牌和一个 ID 令牌,但没有刷新令牌。

我正在将 offline_access 范围传递给 Auth0.authorize()(以及 openid profile)。我正在使用的 API 启用了“Allow Offline Access”。我没有定义规则。

Auth0 中的应用在高级设置中启用了以下授权:隐式、授权代码、刷新令牌。

在我的客户端应用程序的 Auth0 配置中,我设置:

...,
audience: 'xxxxxxxxx', /* My API identifier */
responseType: 'token id_token'

我的重定向回调正在接收哈希参数,例如: access_token=xxxxx&scope=openid%20profile%20offline_access&expires_in=7200&token_type=Bearer&state=xxx&id_token=xxxxx 但没有 refresh_token.

我错过了什么?

如果响应类型是 id_token token 并且 scope 包括 openid,这是一个 OpenID Connect (OIDC) 协议,使用隐式流作为身份验证路径。在这种情况下,不会发出刷新令牌。

来自 OIDC Core 规范:

Authentication can follow one of three paths: the Authorization Code Flow (response_type=code), the Implicit Flow (response_type=id_token token or response_type=id_token), or the Hybrid Flow ...

混合流要求 response_typecode 作为第一个词。因此,您处于隐式流程区域。根据 OIDC 规范,授权代码和混合流会发出刷新令牌,而隐式流不会。