rbrki07 / rn-expo-oauth-authorization-code-flow-pkce-keycloak

React Native (Expo) App with Keycloak and the Authorization Code Flow (with Proof Key for Code Exchange) of OAuth 2.0
MIT License
3 stars 1 forks source link

Request, useAutoDiscovery returns null #3

Open moxie99 opened 2 weeks ago

moxie99 commented 2 weeks ago

Hi,

In IOS, following the steps was easier and straightforward, but using an emulator, the request was null, discovery also null. discovery: ought to show the different endpoints for a token, endsession, and revokeSession url, among others, instead null was returned.

The same goes for request here:

const [request, response, promptAsync] = useAuthRequest( { // @ts-ignore clientId: process.env.EXPO_PUBLIC_KEYCLOAK_CLIENT_ID, redirectUri: redirectUri, scopes: ['openid', 'profile'], }, discovery )

rbrki07 commented 2 weeks ago

Hi,

this seems to be a network related issue. I guess the emulator is not able to reach Keycloak with the given URL. Check the environment variable EXPO_PUBLIC_KEYCLOAK_URL in your local .env file. Instead of localhost you could try and use the concrete ip address of your network interface like 192.168.100.10.

To verify that your emulator can reach Keycloak, try to open Keycloak in a browser in your emulator. If you followed the instructions in the browser, you can reach Keycloak at http://localhost:11111/admin. But again, you may need to change the URL and use the correct ip address instead of localhost.