Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 374 Vote(s) - 3.47 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cognito User Pool and Wordpress Users (signing in to wordpress with AWS)

#1
There are applications that uses Amazon Web Services and AWS User Pool for the user registry. I would like to be able to signed-in to the Wordpress cms site using the AWS app's users / AWS User Pool login info.

Has anyone done something like this?

Any thoughts?
Reply

#2
You can manage such an integration by using the AWS SDK for PHP and writing a wordpress plugin that hooks into the authenticate call as described in the tutorial below:

[To see links please register here]


Instructions for installing the AWS SDK for PHP into your plugin can be found here (I followed the composer instructions to get it working):

[To see links please register here]


After that, a piece of code that deals just with User Pools authentication would be:

require 'vendor/autoload.php';
use Aws\CognitoIdentityProvider\CognitoIdentityProviderClient;
$cognitoIdentityProviderClient = new CognitoIdentityProviderClient(['version' => '2016-04-18',
'region' => 'us-east-1',
'credentials' => array(
'key' => get_option('aws_access_key_id'),
'secret' => get_option('aws_secret_access_key')
)]
);

$authResult = $cognitoIdentityProviderClient->adminInitiateAuth([
'AuthFlow' => 'ADMIN_NO_SRP_AUTH',
'UserPoolId' => get_option('cognito_userpoolid'),
'ClientId' => get_option('cognito_clientid'),
'AuthParameters' => ['USERNAME' => $username, 'PASSWORD' => $password],
]);

This is an authenticated call so it requires AWS credentials as you can see in my code above for the placeholders aws_access_key_id and aws_secret_access_key. Here is a link to AWS documentation for managing credentials in PHP:

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through