|
|
|
@ -52,6 +52,7 @@ public class LoginActivity extends BaseActivity {
|
|
|
|
|
private boolean requestedAdmin;
|
|
|
|
|
|
|
|
|
|
private void manageItent(Intent intent) {
|
|
|
|
|
|
|
|
|
|
if (intent != null && intent.getData() != null && intent.getData().toString().contains(REDIRECT_CONTENT_WEB + "?code=")) {
|
|
|
|
|
String url = intent.getData().toString();
|
|
|
|
|
Matcher matcher = Helper.codePattern.matcher(url);
|
|
|
|
@ -61,9 +62,7 @@ public class LoginActivity extends BaseActivity {
|
|
|
|
|
}
|
|
|
|
|
String code = matcher.group(1);
|
|
|
|
|
OauthVM oauthVM = new ViewModelProvider(LoginActivity.this).get(OauthVM.class);
|
|
|
|
|
|
|
|
|
|
//We are dealing with a Mastodon API
|
|
|
|
|
if (apiLogin == Account.API.MASTODON) {
|
|
|
|
|
//API call to get the user token
|
|
|
|
|
String scope = requestedAdmin ? Helper.OAUTH_SCOPES_ADMIN : Helper.OAUTH_SCOPES;
|
|
|
|
|
oauthVM.createToken(currentInstanceLogin, "authorization_code", client_idLogin, client_secretLogin, Helper.REDIRECT_CONTENT_WEB, scope, code)
|
|
|
|
@ -94,7 +93,6 @@ public class LoginActivity extends BaseActivity {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|