レールに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
を取得し、ユーザ認証のためのバックエンドに渡す必要があります。私は `` `
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-SDKを使用していますが、結果には、私は私がGETユーザー情報のために何をすべきエラーAws::CognitoIdentityProvider::Errors::NotAuthorizedException (Access Token does not have required scopes):
を持っているバックエンドで
?