I am trying to use AppAuth (https://docs.expo.io/versions/latest/sdk/app-auth/) with Azure AD Oauth2 login.
I can authenticate and all like that, but it looks like I don’t get any response back from AppAuth. It just closes down the web browser view. How can I debug this? I am using the Expo iOS Client with a tunnel to the development server.
Example code:
const redirectUrl = Expo.Linking.makeUrl();
const config = {
issuer: 'https://login.microsoftonline.com/<client_id>/v2.0',
scopes: ['openid', 'offline_access'],
clientId: '<client_id>',
redirectUrl: redirectUrl,
};
const StorageKey = 'authState';
export default class LoginScreen extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<View>
<Button title="Sign in with Microsoft" onPress={this._signInAsync} />
</View>
);
}
_cacheAuthAsync = async (authState) => {
return AsyncStorage.setItem(StorageKey, JSON.stringify(authState));
}
_signInAsync = async () => {
console.log(redirectUrl);
const authState = await AppAuth.authAsync(config);
console.log(authState); // Never gets here...
this.props.navigation.navigate('Main');
};
}