mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-24 07:01:05 +00:00
Added Gmail web OAuth flow
Thanks @cketti for pointing in the right direction!
This commit is contained in:
parent
86267a654f
commit
c10abc0db0
8 changed files with 59 additions and 6 deletions
|
@ -465,6 +465,15 @@
|
|||
|
||||
<data android:scheme="eu.faircode.email" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="eu.faircode.email.debug" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<service
|
||||
|
|
|
@ -469,6 +469,15 @@
|
|||
|
||||
<data android:scheme="eu.faircode.email" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="eu.faircode.email.debug" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<service
|
||||
|
|
|
@ -469,6 +469,15 @@
|
|||
|
||||
<data android:scheme="eu.faircode.email" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="eu.faircode.email.debug" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<service
|
||||
|
|
|
@ -463,6 +463,15 @@
|
|||
|
||||
<data android:scheme="eu.faircode.email" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="eu.faircode.email.debug" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<service
|
||||
|
|
|
@ -403,12 +403,19 @@ public class FragmentOAuth extends FragmentBase {
|
|||
? new LinkedHashMap<>()
|
||||
: provider.oauth.parameters);
|
||||
|
||||
String clientId = provider.oauth.clientId;
|
||||
Uri redirectUri = Uri.parse(provider.oauth.redirectUri);
|
||||
if ("gmail".equals(id) && BuildConfig.DEBUG) {
|
||||
clientId = "803253368361-hr8kelm53hqodj7c6brdjeb2ctn5jg3p.apps.googleusercontent.com";
|
||||
redirectUri = Uri.parse("eu.faircode.email.debug:/");
|
||||
}
|
||||
|
||||
AuthorizationRequest.Builder authRequestBuilder =
|
||||
new AuthorizationRequest.Builder(
|
||||
serviceConfig,
|
||||
provider.oauth.clientId,
|
||||
clientId,
|
||||
ResponseTypeValues.CODE,
|
||||
Uri.parse(provider.oauth.redirectUri))
|
||||
redirectUri)
|
||||
.setScopes(provider.oauth.scopes)
|
||||
.setState(provider.id)
|
||||
.setAdditionalParameters(params);
|
||||
|
|
|
@ -165,6 +165,7 @@
|
|||
android:text="@string/title_setup_gmail_on_device"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="?android:attr/textColorLink"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvSelectHint" />
|
||||
|
|
|
@ -23,15 +23,15 @@
|
|||
<oauth
|
||||
askAccount="true"
|
||||
authorizationEndpoint="https://accounts.google.com/o/oauth2/auth"
|
||||
clientId="495454862802-rkeb9fs6i6aqs99ieureo5nugc5g98lc.apps.googleusercontent.com"
|
||||
clientSecret="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"
|
||||
enabled="false"
|
||||
clientId="803253368361-11ias0ee6bqhvdi4f21fs1lh7fsb0il2.apps.googleusercontent.com"
|
||||
enabled="true"
|
||||
privacy="https://policies.google.com/privacy"
|
||||
prompt="consent"
|
||||
redirectUri="https://oauth.faircode.eu/"
|
||||
redirectUri="eu.faircode.email:/"
|
||||
scopes="https://mail.google.com/"
|
||||
tokenEndpoint="https://oauth2.googleapis.com/token">
|
||||
<!-- https://developers.google.com/identity/protocols/oauth2/native-app -->
|
||||
<!-- https://github.com/openid/AppAuth-Android/blob/master/app/README-Google.md -->
|
||||
<parameter
|
||||
key="access_type"
|
||||
value="offline" />
|
||||
|
|
|
@ -465,6 +465,15 @@
|
|||
|
||||
<data android:scheme="eu.faircode.email" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="eu.faircode.email.debug" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<service
|
||||
|
|
Loading…
Reference in a new issue