dou*_*jam 5 php vue.js amazon-cognito aws-amplify
我正在尝试为我的 Vue 应用程序使用 amplify,但遇到一些问题。
当我通过手动身份验证时Auth.signIn,一切顺利,我获得访问令牌,将其传递到后端并获取我想要的数据。
但我想通过不必构建重置、确认、忘记密码的流程来节省时间,然后我尝试使用Auth.federatedSignIn
当我这样做时,身份验证也工作正常,但是当我传递 accessToken 时,我到达了后端,即抱怨以下内容:
Access Token does not have required scopes
Error executing "GetUser" on "https://cognito-idp.eu-central-1.amazonaws.com"; AWS HTTP error: Client error: `POST https://cognito-idp.eu-central-1.amazonaws.com` resulted in a `400 Bad Request` response:
{"__type":"NotAuthorizedException","message":"Access Token does not have required scopes"}
NotAuthorizedException (client): Access Token does not have required scopes - {"__type":"NotAuthorizedException","message":"Access Token does not have required scopes"}
Run Code Online (Sandbox Code Playgroud)
我如何调用Auth.federatedSignIn()并使我的令牌具有与这些范围完全相同的范围Auth.signIn()?我还需要添加其他参数吗?
我不认为这是我的 PHP/aws-sdk 授权部分,因为当我传递通过Auth.signIn()
这是我目前对放大的论点Amplify.configure()
Error executing "GetUser" on "https://cognito-idp.eu-central-1.amazonaws.com"; AWS HTTP error: Client error: `POST https://cognito-idp.eu-central-1.amazonaws.com` resulted in a `400 Bad Request` response:
{"__type":"NotAuthorizedException","message":"Access Token does not have required scopes"}
NotAuthorizedException (client): Access Token does not have required scopes - {"__type":"NotAuthorizedException","message":"Access Token does not have required scopes"}
Run Code Online (Sandbox Code Playgroud)
小智 0
Auth.signIn()并Auth.federatedSignIn()返回不同的东西,你可以查看 Github 中 Auth Amplify 的源代码来查看。
基本上从属性映射federatedSignIn返回credentials,同时返回 Cognito 用户、令牌、会话……attributessignIn
因此,无论您如何尝试配置它,要求Auth.federatedSignIn()返回相同的值都是不可能的。Auth.signIn()