Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not have "Sign In with Cognito" link in the login page #1

Open
marcoarruda opened this issue Aug 19, 2019 · 5 comments
Open

Could not have "Sign In with Cognito" link in the login page #1

marcoarruda opened this issue Aug 19, 2019 · 5 comments

Comments

@marcoarruda
Copy link

Hello,

I tried to follow the tutorial found here: https://www.cakedc.com/ajibarra/2019/03/15/how-to-cakephp-cakedc-users-and-amazon-cognito

But at the end I could not find the link "Sign In with Cognito" at the login page.

Is there something missing? Maybe I need to create the link manually and don't get it throughout the instructions.

Thanks in advance

@roshnimansuri
Copy link

Hi @marcoarruda , I am looking for the same. If you get anything to integrate Cognito with cakephp then please let me know. Any help will be appreciated! Thanks

@marcoarruda
Copy link
Author

Hi @marcoarruda , I am looking for the same. If you get anything to integrate Cognito with cakephp then please let me know. Any help will be appreciated! Thanks

Hi! So far nothing from here, thanks for the support on that issue

@ajibarra
Copy link
Member

ajibarra commented Apr 29, 2021

Hey guys @roshnimansuri @marcoarruda, I am sorry I have missed this. I have updated article because I noticed some configuration details were in a wrong section.

If you are using Users plugin templates as recommended you just need to enable social login using

'Users.Social.login' => true

What I usually do is copying the whole users.php file to my app/config folder and then I add any configuration I want to include like previous one. Remember you also need to include clientID, secret, etc using:

'OAuth.providers.cognito.options.clientId' => 'CLIENT_ID',
'OAuth.providers.cognito.options.clientSecret' => 'CLIENT_SECRET',
'OAuth.providers.cognito.options.cognitoDomain' => 'DOMAIN',
'OAuth.providers.cognito.options.region' => 'REGION',

Please let me know if you still have problems and include your custom users.php file, you should remove sensitive information before pasting content here.

@mattjohnsaint
Copy link

mattjohnsaint commented Dec 1, 2021

Hi,

I think I had the same issue with the docs but worked my way through it.
The docs at https://www.cakedc.com/ajibarra/2019/03/15/how-to-cakephp-cakedc-users-and-amazon-cognito

are missing a line of code.

It says

Add the following code to your src/Application.php pluginBootstrap() method to ensure we override the plugin defaults

But there is no code snippet after.

Working my way through the main cakedc plugin docs I found the answer.
edit src/Application.php

Find where it says
$this->addPlugin('CakeDC/Users');
and add
Configure::write('Users.config', ['users']);

Also don't forget that config/users.php must start with <?PHP and close with ?>

Matt

@mattjohnsaint
Copy link

mattjohnsaint commented Dec 1, 2021

Also on Cakephp 4.3 I also had to fix the routing syntax

Colon prefixed route placeholders like :fooare deprecated. Use braced placeholders like{foo}instead. - /var/www/html/vendor/cakephp/cakephp/src/Routing/Route/Route.php, line: 300 You can disable all deprecation warnings by settingError.errorLeveltoE_ALL & ~E_USER_DEPRECATED, or add vendor/cakephp/cakephp/src/Routing/Route/Route.phptoError.ignoredDeprecationPathsin yourconfig/app.php to mute deprecations from only this file.

Same as this issue from teh main cakedc
CakeDC/users#972

changed /:provider to /{provider}

in both

vendor/cakedc/users/config/routes.php
vendor/cakedc/auth/config/bootstrap.php

Lastly, After running bin/cake migrations migrate -p CakeDC/Users to create the tables, I also had to make some changes to the social_accounts table to allow for the token. I changed both token and token_secret to text as var char 500 was too small.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants