import * as AuthSession from 'expo-auth-session'; import {TokenResponse} from 'expo-auth-session'; import * as WebBrowser from 'expo-web-browser'; import React, {useEffect, useState} from 'react'; import {Button, Text, View} from "react-native"; WebBrowser.maybeCompleteAuthSession(); // const redirectURI = AuthSession.makeRedirectUri({native: 'http://127.0.0.1:8082/ssoCallback', // TODO: why is it translated to localhost? Why /ssoCallback is missing?}); const redirectURI = 'https://poc-sso-marn.van-hemmen.com/ssoCallback'; console.log(redirectURI); export default function indexScreen() { const [tokenResponse, setTokenResponse] = useState(null); const clientId = '509-marn-app'; const discovery = AuthSession.useAutoDiscovery('https://auth-integ.partenamut.be/login/oauth2'); const [request, result, promptAsync] = AuthSession.useAuthRequest( { clientId, redirectUri: redirectURI, usePKCE: true, }, discovery, ); useEffect(() => { console.log('result'); console.log(result); }, [result]); useEffect(() => { console.log('request'); console.log(request); request?.makeAuthUrlAsync(discovery!).then(value => console.log(value)); }, [request]); useEffect(() => { console.log('tokenResponse'); console.log(tokenResponse); }, [tokenResponse]); return ( HOME PAGE