Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/resource_owners/amazon_cognito.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ hwi_oauth:
scope: "email openid" #needs to be enabled in cognito (profile, phone)
options:
region: <pool_region>
domain: <pool_domain>
domain: <pool_domain> or <custom_domain> like https://yoursite.com
```

When you're done. Continue by configuring the security layer or go back to
Expand Down
4 changes: 4 additions & 0 deletions src/OAuth/ResourceOwner/AmazonCognitoResourceOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ protected function configureOptions(OptionsResolver $resolver)
]);

$normalizer = function (Options $options, $value) {
if (str_starts_with($options['domain'], 'https://') || str_starts_with($options['domain'], 'http://')) {
return str_replace('{base_url}', $options['domain'], $value);
}

$baseUrl = \sprintf('https://%s.auth.%s.amazoncognito.com', $options['domain'], $options['region']);

return str_replace('{base_url}', $baseUrl, $value);
Expand Down
Loading