This is my code but after that with the “response” I need to do to get the data of the user who logged in to Azure.
import * as React from ‘react’;
import { Button, Text, View } from ‘react-native’;
import * as AuthSession from ‘expo-auth-session’;
import * as WebBrowser from ‘expo-web-browser’;
WebBrowser.maybeCompleteAuthSession();
const useProxy = true;
const redirectUri = AuthSession.makeRedirectUri({
useProxy,
});
export default function App() {
const discovery = AuthSession.useAutoDiscovery(‘https://demo.identityserver.io’);
// Create and load an auth request
const [request, result, promptAsync] = AuthSession.useAuthRequest(
{
clientId: ‘native.code’,
redirectUri,
scopes: [‘openid’, ‘profile’, ‘email’, ‘offline_access’],
},
discovery
);
React.useEffect(() => {
if (response?.type === 'success') {
const {code} = response.params
console.log(response)
}
}, [response]);
return (
<View style={{ flex: 1, justifyContent: ‘center’, alignItems: ‘center’ }}>
<Button title=“Login!” disabled={!request} onPress={() => promptAsync({ useProxy })} />
{result && {JSON.stringify(result, null, 2)}}
);
}