chi2labs / cognitoR

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

Error in login #12

Closed gdlzzz closed 3 years ago

gdlzzz commented 4 years ago

When i delete cookies from web-browser and i login in aws cognito there is the error:

Warning: Error in : $ operator is invalid for atomic vectors
  96: renderUI [/opt/shiny-server/samples/sample-apps/rmd/app.R#47]
  95: func
  82: origRenderFunc
  81: output$logout-who
   1: runApp
Warning: Error in $: $ operator is invalid for atomic vectors
  100: unlist
   96: renderUI [/opt/shiny-server/samples/sample-apps/rmd/app.R#64]
   95: func
   82: origRenderFunc
   81: output$content
    1: runApp
ppagnone commented 4 years ago

Hello @gdlzzz, Could you add a reproducible code example? I tried and I can't reproduce the reported. Could you reproduce the problem with the demo app included in the package? What configuration is "Authorization Code Grant" or "Implicit Grant" using?

Thanks in advance

gdlzzz commented 4 years ago

Hi @ppagnone, using the "simple-login-app.R" script on a shiny-server with "Implicit Grant" the error pop-up in case you add a new user or if you delete the cookies inside your browser before the login. I loaded the script inside a shiny-server. In AWS cognito and in the .yml file, the callback is the url and not the local port (i've modified also the oauth_flow from "code" to "token"). Once you create a new user in cognito, the "Account status" is "Force change Password", if you log inside the application. the login force you to change the temporary password, after this the error will appears; to overcome the problem you need to refresh the page and it will work; i did some debugging and the problem is in "cognitomod", the variable is atomic and you can't access it with "$".

gdlzzz commented 4 years ago

@ppagnone in my opinion the problem is with httr package. httr::set_config(httr::config(http_version = 1.1)) may be can solve the issue

ppagnone commented 4 years ago

Hi @gdlzzz , thanks for the new information. I was trying with differentes configurations and I was not able to reproduce. About the httr package, I tested with the differentes http versions and all worked well.

I will continue trying it but if you have some new idea or some extra information, that will be welcome. Did you try to run the application in https://www.shinyapps.io/ ? I ask about this to discard a problem in the server configuration.

Regards!