chi2labs / cognitoR

CognitoR provides easy integration of Shiny with AWS Cognito Authentication.
22 stars 9 forks source link

Does cognitoR require usage of app.R? #23

Closed pstraforelli closed 3 years ago

pstraforelli commented 3 years ago

Hello,

I recognize that this is not an issue per se as much as a question, so feel free to close if it is not the right avenue. We are trying to implement the cognitoR framework to our app, except that it's split over a ui.R, server.R, and global.R file, and we're running into difficulties in making the app go live.

As we're trying to troubleshoot, I note that all your examples are of the app.R variety - is this a requirement for the successful implementation of cognitoR into an app?

ppagnone commented 3 years ago

Hi @pstraforelli , the package should to work with any Shiny structure, not is a requirement the app.R variery. Even we made some projects with shiny modules and worked correctly. Let me know any problem.

Regards

ppagnone commented 3 years ago

@pstraforelli I saw your comment with a code via email (I guess than was removed from here), your example worked correctly for me with a instance of Cognito than I had configured.

My suggestion are:

If you have some error in your console please share here. Or let me know where is failling for you.. in redirection? Do you see the UI of Cognito? Regards

pstraforelli commented 3 years ago

Hi @ppagnone Sorry for the lack of reply and my deleting of my comment. Indeed it did work for me (the error was due to something unrelated). I'm still troubleshooting an actual app, and I have another question. Could I have the server.R file include the session argument? For instance, I'm using shinyWidgets::updateMaterialSwitch() which requires a session object.

EDIT: Never mind, I see that you do include session in your examples, e.g.: https://github.com/chi2labs/cognitoR/blob/master/inst/examples/cognito-mobile-app.R

ppagnone commented 3 years ago

Yes, @pstraforelli in all shiny server functions you have available the session object ( also input and output). Regards!

pstraforelli commented 3 years ago

Hi @ppagnone thanks for your patience and indulging with me as I was knocking my head around working out the usage of the cognitoR features. I have it all worked out now. Cheers.

ppagnone commented 3 years ago

@pstraforelli No problem! Happy all worked well! Cheers!