{"id":14068421,"url":"https://github.com/Tim113/shinyauth","last_synced_at":"2025-07-30T04:30:55.856Z","repository":{"id":221616426,"uuid":"104227954","full_name":"Tim113/shinyauth","owner":"Tim113","description":"Adds authorisation to a shinydashboard, it's not that complicated.","archived":false,"fork":false,"pushed_at":"2018-01-26T17:27:05.000Z","size":40,"stargazers_count":7,"open_issues_count":3,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-13T07:14:48.864Z","etag":null,"topics":["authentication","r","shiny","shinydashboard"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Tim113.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-09-20T14:42:28.000Z","updated_at":"2020-08-26T23:23:17.000Z","dependencies_parsed_at":"2024-02-09T02:29:47.110Z","dependency_job_id":null,"html_url":"https://github.com/Tim113/shinyauth","commit_stats":null,"previous_names":["tim113/shinyauth"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tim113%2Fshinyauth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tim113%2Fshinyauth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tim113%2Fshinyauth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tim113%2Fshinyauth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tim113","download_url":"https://codeload.github.com/Tim113/shinyauth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228082283,"owners_count":17866601,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","r","shiny","shinydashboard"],"created_at":"2024-08-13T07:06:09.946Z","updated_at":"2024-12-04T09:30:50.490Z","avatar_url":"https://github.com/Tim113.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"# shinyauth \n  \nTo use this pacakge you must have a MySQL databse accessable by a shiny app where your dashboard is to be run, and a config file based on the tempate provided. \n  \n### shinyauth setup \nFirst you must have a shema in your MySQL database and a user with full write privileges for the shema.  The name of this shema and the users login detils need to be in the config file for shiny basic auth (see example for the whole file), \n``` \nusers_table: \n  dbname_auth: shinyauth \n  username: auth_user \n  password: password123 \n  host: 127.0.0.1 \n  port: 3306 \n``` \n \nThen you can make the User tables using the following command, it will create a table in your db called Users, and along with a first user as specified in your config file (again see the minimal example). \n``` \nshinyauth::create_auth_tables(auth_config_path = \"./auth_conf.yaml\") \n\u003e TRUE \n``` \nOnce this table exists you can run the dashboard and will be able to log in user the user just created. \n## Creating the dashboard \nThere are two main differences between a regular shinydashboard, and a dashboard made using shinyauth. \n1) The top level server function is called passed `auth_server` instead of being called in server.R (or main.R \n2) The `saSidebar` and `asBody` are used inseted of `dashboardSidebar` and ``dashboardBody` respectivly \n \n### 1) Changes to server function \nFor a regular shinydashbaord your server file will look something like this \n``` \n## server.R ## \nlibrary(shiny) \nserver = function(input, output, session) {  \n   # Some code and hopefully comments \n} \n``` \nTo change this to work with shinyauth it must look like this \n``` \n## server.R ## \nlibrary(shiny) \nserver_post_auth =  function(input, output, session, auth) {  \n   # Some code and hopefully comments \n} \n### Call the auth server \nshinyauth::auth_server( \n  server      = server_post_auth, \n  config_path = \"./auth_conf.yaml\") \n``` \nThere are two differences.  Firstly your server function is passed to shinyauth::auth_server which will not run it until a users successfully logs in.  Secondly the server function accepts a forth argument, `auth`, this list is needed by all shinyauth functions.  (Read more about the auth object below). \n \n### 2) Changes to ui \nIn shinydashbaord your ui file will have this layout: \n``` \n## ui.R ##  \nlibrary(shiny)  \ndashboardPage(  \n   dashboardHeader(),  \n   dashboardSidebar(),  \n   dashboardBody() \n) \n``` \nFor shinyauth this needs to be: \n## ui.R ## \nlibrary(shiny) \ndashboardPage( \n   dashboardHeader(), \n   saSidebar(), \n   saBody() \n) \n``` \nThis is because shinyauth needs additional ui elements in the side bar and the ui to function. \n \n \n \n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTim113%2Fshinyauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTim113%2Fshinyauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTim113%2Fshinyauth/lists"}