我应该在rails上集成cognito + ruby。AWS Cognito + RubyOnRails在后端获取用户信息。 Aws :: CognitoIdentityProvider :: Errors :: NotAuthorizedException
我的用户用cognito
登录了默认登录页面,并用url params重定向到了我的页面。
https://development-my-site.auth.us-west-2.amazoncognito.com/oauth2/authorize?client_id=62i222222222222&redirect_uri=https://c3ffec02.ngrok.io/auth/cognito/callback&response_type=token&scope=email+openid+profile
重定向后,我有PARAMS
id_token=eyJraWQiOiIyYThzTzY3........
&access_token=eyJraWQiOiJDa0I2NGJsUFJKTWZrNGlV.....
&expires_in=3600
&token_type=Bearer
我应该从URL access_token
,并传递给后台在用户认证。
在后端我使用AWS-SDK ```
def client
@client ||= Aws::CognitoIdentityProvider::Client.new(region: options.aws_region)
end
def get_user_info(params)
client.get_user(access_token: params['access_token'])
end
```
但结果我有错误Aws::CognitoIdentityProvider::Errors::NotAuthorizedException (Access Token does not have required scopes):
我应该得到用户的信息做什么?