mirror of
				https://codeberg.org/tom79/Fedilab.git
				synced 2025-10-20 11:20:16 +03:00 
			
		
		
		
	Fix authentication issue
This commit is contained in:
		
							parent
							
								
									5ddc756440
								
							
						
					
					
						commit
						4c375cfe4a
					
				
					 1 changed files with 27 additions and 29 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue