Skip to content
This repository was archived by the owner on May 20, 2022. It is now read-only.

Commit 9aa35da

Browse files
authored
Merge pull request #110 from UN-ICC/fix_guest_tenant_user_login
2 parents 97a8503 + 2bb5727 commit 9aa35da

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

android/src/main/java/com/reactnativemsal/RNMSALModule.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.microsoft.identity.client.AuthenticationCallback;
2626
import com.microsoft.identity.client.IAccount;
2727
import com.microsoft.identity.client.IAuthenticationResult;
28+
import com.microsoft.identity.client.IMultiTenantAccount;
2829
import com.microsoft.identity.client.IMultipleAccountPublicClientApplication;
2930
import com.microsoft.identity.client.Prompt;
3031
import com.microsoft.identity.client.PublicClientApplication;
@@ -394,7 +395,11 @@ private WritableMap msalResultToDictionary(@NonNull IAuthenticationResult result
394395
WritableMap map = Arguments.createMap();
395396
map.putString("accessToken", result.getAccessToken());
396397
map.putString("expiresOn", String.format("%s", result.getExpiresOn().getTime() / 1000));
397-
map.putString("idToken", result.getAccount().getIdToken());
398+
String idToken = result.getAccount().getIdToken();
399+
if (idToken==null){
400+
idToken = ((IMultiTenantAccount) result.getAccount()).getTenantProfiles().get(result.getTenantId()).getIdToken();
401+
}
402+
map.putString("idToken", idToken);
398403
map.putArray("scopes", Arguments.fromArray(result.getScope()));
399404
map.putString("tenantId", result.getTenantId());
400405
map.putMap("account", accountToMap(result.getAccount()));

0 commit comments

Comments
 (0)