mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-18 09:07:48 -04:00
[MS OAuth] Implemented code receiver after login
This commit is contained in:
parent
79791efb4d
commit
4e1a4e223d
@ -34,8 +34,8 @@
|
|||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
<data android:host="login.live.com" android:scheme="https"
|
<data android:scheme="ms-xal-00000000402b5328"
|
||||||
android:pathPrefix="/oauth20_desktop.srf"/>
|
android:host="auth"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ import net.kdt.pojavlaunch.prefs.*;
|
|||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.lwjgl.glfw.*;
|
import org.lwjgl.glfw.*;
|
||||||
|
import android.net.*;
|
||||||
|
|
||||||
public class PojavLoginActivity extends BaseActivity
|
public class PojavLoginActivity extends BaseActivity
|
||||||
// MineActivity
|
// MineActivity
|
||||||
@ -305,6 +306,24 @@ public class PojavLoginActivity extends BaseActivity
|
|||||||
PojavProfile.setCurrentProfile(this, null);
|
PojavProfile.setCurrentProfile(this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onNewIntent(Intent intent) {
|
||||||
|
super.onNewIntent(intent);
|
||||||
|
|
||||||
|
Uri data = intent.getData();
|
||||||
|
if (data != null && data.getScheme().equals("ms-xal-00000000402b5328") && data.getHost().equals("auth")) {
|
||||||
|
String error = data.getQueryParameter("error");
|
||||||
|
String error_description = data.getQueryParameter("error_description");
|
||||||
|
if (error != null && !error_description.startsWith("The user has denied access to the scope requested by the client application")) {
|
||||||
|
// "The user has denied access to the scope requested by the client application": user pressed Cancel button, skip it
|
||||||
|
Toast.makeText(this, "Error: " + error + ": " + error_description, Toast.LENGTH_LONG).show();
|
||||||
|
} else {
|
||||||
|
String code = data.getQueryParameter("code");
|
||||||
|
Toast.makeText(this, "Logged in to Microsoft account, but NYI", Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isJavaRuntimeInstalled(AssetManager am) {
|
private boolean isJavaRuntimeInstalled(AssetManager am) {
|
||||||
boolean prefValue = firstLaunchPrefs.getBoolean(PREF_IS_INSTALLED_JAVARUNTIME, false);
|
boolean prefValue = firstLaunchPrefs.getBoolean(PREF_IS_INSTALLED_JAVARUNTIME, false);
|
||||||
try {
|
try {
|
||||||
@ -625,7 +644,7 @@ public class PojavLoginActivity extends BaseActivity
|
|||||||
public void loginMicrosoft(View view) {
|
public void loginMicrosoft(View view) {
|
||||||
// TODO
|
// TODO
|
||||||
// Documentation: https://wiki.vg/Microsoft_Authentication_Scheme
|
// Documentation: https://wiki.vg/Microsoft_Authentication_Scheme
|
||||||
CustomTabs.openTab(this, "https://login.live.com/oauth20_authorize.srf?client_id=00000000402b5328&response_type=code&scope=service%3A%3Auser.auth.xboxlive.com%3A%3AMBI_SSL&redirect_uri=https%3A%2F%2Flogin.live.com%2Foauth20_desktop.srf");
|
CustomTabs.openTab(this, "https://login.live.com/oauth20_authorize.srf?client_id=00000000402b5328&response_type=code&scope=service%3A%3Auser.auth.xboxlive.com%3A%3AMBI_SSL&redirect_url=https%3A%2F%2Flogin.live.com%2Foauth20_desktop.srf");
|
||||||
}
|
}
|
||||||
|
|
||||||
// developer methods
|
// developer methods
|
||||||
|
Loading…
x
Reference in New Issue
Block a user