Skip to content

Commit

Permalink
Add Office365 OAuth config
Browse files Browse the repository at this point in the history
  • Loading branch information
wmontwe committed Jul 30, 2024
1 parent 741be16 commit 20f2328
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory {
return mapOf(
createAolConfiguration(),
createGmailConfiguration(),
createMicrosoftConfiguration(),
createYahooConfiguration(),
)
}
Expand Down Expand Up @@ -42,6 +43,23 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory {
)
}

private fun createMicrosoftConfiguration(): Pair<List<String>, OAuthConfiguration> {
return listOf(
"outlook.office365.com",
"smtp.office365.com",
) to OAuthConfiguration(
clientId = "e6f8716e-299d-4ed9-bbf3-453f192f44e5",
scopes = listOf(
"https://outlook.office.com/IMAP.AccessAsUser.All",
"https://outlook.office.com/SMTP.Send",
"offline_access",
),
authorizationEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize",
tokenEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/token",
redirectUri = "msauth://net.thunderbird.android.beta/oXQR8QkspkdQCotvApfiBQiPQBU%3D",
)
}

private fun createYahooConfiguration(): Pair<List<String>, OAuthConfiguration> {
return listOf(
"imap.mail.yahoo.com",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory {
return mapOf(
createAolConfiguration(),
createGmailConfiguration(),
createMicrosoftConfiguration(),
createYahooConfiguration(),
)
}
Expand Down Expand Up @@ -42,6 +43,23 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory {
)
}

private fun createMicrosoftConfiguration(): Pair<List<String>, OAuthConfiguration> {
return listOf(
"outlook.office365.com",
"smtp.office365.com",
) to OAuthConfiguration(
clientId = "e6f8716e-299d-4ed9-bbf3-453f192f44e5",
scopes = listOf(
"https://outlook.office.com/IMAP.AccessAsUser.All",
"https://outlook.office.com/SMTP.Send",
"offline_access",
),
authorizationEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize",
tokenEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/token",
redirectUri = "msauth://net.thunderbird.android.daily/KUkL9b7kcXs%2FtgmDCGD54ka8Bow%3D",
)
}

private fun createYahooConfiguration(): Pair<List<String>, OAuthConfiguration> {
return listOf(
"imap.mail.yahoo.com",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory {
return mapOf(
createAolConfiguration(),
createGmailConfiguration(),
createMicrosoftConfiguration(),
createYahooConfiguration(),
)
}
Expand Down Expand Up @@ -42,6 +43,23 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory {
)
}

private fun createMicrosoftConfiguration(): Pair<List<String>, OAuthConfiguration> {
return listOf(
"outlook.office365.com",
"smtp.office365.com",
) to OAuthConfiguration(
clientId = "e6f8716e-299d-4ed9-bbf3-453f192f44e5",
scopes = listOf(
"https://outlook.office.com/IMAP.AccessAsUser.All",
"https://outlook.office.com/SMTP.Send",
"offline_access",
),
authorizationEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize",
tokenEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/token",
redirectUri = "msauth://net.thunderbird.android.debug/eaXDuh6T3KFWjcJhsoaObT9OayU%3D",
)
}

private fun createYahooConfiguration(): Pair<List<String>, OAuthConfiguration> {
return listOf(
"imap.mail.yahoo.com",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory {
return mapOf(
createAolConfiguration(),
createGmailConfiguration(),
createMicrosoftConfiguration(),
createYahooConfiguration(),
)
}
Expand Down Expand Up @@ -42,6 +43,23 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory {
)
}

private fun createMicrosoftConfiguration(): Pair<List<String>, OAuthConfiguration> {
return listOf(
"outlook.office365.com",
"smtp.office365.com",
) to OAuthConfiguration(
clientId = "e6f8716e-299d-4ed9-bbf3-453f192f44e5",
scopes = listOf(
"https://outlook.office.com/IMAP.AccessAsUser.All",
"https://outlook.office.com/SMTP.Send",
"offline_access",
),
authorizationEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize",
tokenEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/token",
redirectUri = "msauth://net.thunderbird.android/S9nqeF27sTJcEfaInpC%2BDHzHuCY%3D",
)
}

private fun createYahooConfiguration(): Pair<List<String>, OAuthConfiguration> {
return listOf(
"imap.mail.yahoo.com",
Expand Down

0 comments on commit 20f2328

Please sign in to comment.