Email Functionality Issue: Unstable API Causing Authentication Process to Hang Indefinitely
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- azure, r
- Domain
- authentication
Research direction
Start with get_business_outlook and the Microsoft365R authentication flow invoked by send.email before each message. Reproduce the intermittent hang while reviewing send.multiple_emails and the surrounding email loop. Done means identifying whether the delay is in the application or API authentication and documenting a verified fix or workaround.
Written by the indexing model from the issue text.
Description
Description:
We have been attempting to reactivate the email functionality in our Shiny application using the Microsoft365R API. However, we have encountered a persistent issue that we would appreciate your assistance with.
When the button to send emails is pressed, the application loops over users and sends the email. However, before sending the email to each user, an authentication page opens for logging in and displays a message that the page can now be closed. Occasionally, the API gets stuck on the authentication page and does not return to the app, causing the loading spinner to remain stuck indefinitely.
We have been unable to find a workaround or solution for this issue, and we suspect that it may originate from the API side. We would greatly appreciate any guidance or suggestions that you could provide to help us resolve this problem.
Thank you in advance for your assistance.
Code snippet:
# Email-sending function
send.email = function(user_from, email_to, email_subject, record) {
show_modal_spinner(spin = "circle", text = "Sending email to " %+% email_to %+% "...")
# Open Outlook connection
outlook_conn = get_business_outlook()
# Create email body containing a properly formatted version of the record
record_rotated = sjmisc::rotate_df(record, rn = "Field") %>% tidyr::replace_na(list(V1 = ""))
email_body = record_rotated %>% dplyr::mutate(Field = "<b>" %+% Field %+% ":</b>") %>% purrr::pmap_chr(paste, collapse = "") %>% paste(collapse = "<br><br>")
# Send email
email = compose_email(body = md(email_body), footer = md(""))
email = outlook_conn$create_email(email, subject = email_subject, to = email_to)
email$send()
}
# Main application code calling the email-sending function
if (table_obj$abbr %in% c("req", "reqh")) {
# Extract email from current user and all data users
current_user = db[["usr"]][["current_user"]]
email_current_user = db[["usr"]]$content %>% dplyr::filter(User == current_user) %>% dplyr::pull(Email)
email_data_users = db[["usr"]]$content %>% dplyr::filter(Type == "Data user") %>% dplyr::pull(Email)
# Send email to current user and all data users with the current record
users_email_to = c(email_current_user, email_data_users) %>% unique()
if (grepl("add", id) == T & table_obj$abbr == "req") {
email_subject = "New request from " %+% current_user
}
if (grepl("add", id) == T & table_obj$abbr == "reqh") {
email_subject = "New request history record from " %+% current_user
}
if (grepl("edit", id) == T & table_obj$abbr == "req") {
email_subject = "Update to request " %+% record$ID
}
if (grepl("edit", id) == T & table_obj$abbr == "reqh") {
email_subject = "Update to request history record " %+% record$ID
}
send.multiple_emails(current_user, users_email_to, email_subject, record)
}
- Dominant language
- R
- Stars
- 48
- Forks
- 23
- Avg merge
- 4h 2m
- Merged PRs (30d)
- 3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Azure/AzureAuth
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 20/100
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
Similar issues
-
documentation pkg infrastructure
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
epiverse-trace/epiparameter#511 ·
-
function:write_dwc
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Urgent request: Due to vulnerabilities move to API version 12.6.1 (12.6.2 eventually) or 13.1.1 Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
jbkunst/highcharter#849 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
r-lib/pkgdepends#485 · 3 comments ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100