In order for this to work in the iOS simulator with the bare workflow the redirect URI would be your apps scheme. For instance myScheme://

In a managed project scheme should be specified inside app.json/app.config.js/app.config.ts. For bare workflow this would reside in Info.plist (iOS) and AndroidManifest.xml (Android).

You would typically set up myScheme://* under valid redirect URIs in Keycloak.

For local testing with web you would also like to add http://localhost:8081/* as a valid redirect URI if you run your expo project on the default port.

For testing with Expo Go you could add exp* as a valid redirect URI.

Answer from unbreakable163 on Stack Overflow
🌐
GitHub
gist.github.com › lemmensaxel › 72ece5cd00026cc05888701d7d65fbe0
React-native expo + keycloak PKCE flow implemented using expo AuthSession · GitHub
It says: "The Authorization Server SHOULD prompt the End-User for reauthentication". Keycloak is doing exactly that. To solve my case, I just had to not send the prompt parameter. Now it works as I expect: it will only promt for login again in case of complete timeout without refresh.
🌐
Rene-wilby
rene-wilby.de › en › blog › rn-expo-oauth-authorization-code-flow-pkce-keycloak
React Native and Expo with Keycloak and the Authorization Code Flow (PKCE) of OAuth 2.0 | René Wilby | Freelance Software Engineer
March 26, 2024 - Together with the other required parameters grant_type, client_id, code_verifier and redirect_uri, the request is sent to Keycloak. The code_verifier parameter used here was previously generated by the expo-auth-session module and is part of the PKCE described above.
🌐
Reddit
reddit.com › r/reactnative › how to get keycloak access token using expo auth session?
r/reactnative on Reddit: How to get Keycloak access token using expo auth session?
October 27, 2023 -

I want to send data from my app to an express js server, and I'd like to protect my api route. In the past I've done this by using keycloak.protect() on the server side, and I put the bearer token in the request in the client side code. However, if I set the response type to token, like this:

const [request, result, promptAsync] = useAuthRequest(
{
clientId: "app_client",
redirectUri: makeRedirectUri({
scheme: "exp",
}),
responseType: "token",
scopes: ["openid", "profile"],
},
discovery
);

then I get an error, stating my keycloak client won't use implicit flow. If I enable it, the token is sent back in the deep link redirect url, which, I believe is not secure. So how should I go about it?

🌐
Expo Documentation
docs.expo.dev › guides › authentication
Authentication with OAuth or OpenID providers - Expo Documentation
Learn how to utilize the expo-auth-session library to implement authentication with OAuth or OpenID providers.
🌐
GitHub
github.com › rubhiauliatirta › expo-keycloak-auth
GitHub - rubhiauliatirta/expo-keycloak-auth: expo-auth-session wrapper for keycloak authentication npm package
expo-auth-session wrapper for keycloak authentication npm package - rubhiauliatirta/expo-keycloak-auth
Starred by 9 users
Forked by 23 users
Languages   JavaScript
🌐
GitHub
github.com › balgamat › expo-keycloak
GitHub - balgamat/expo-keycloak: TypeScript + Expo + Keycloak login
// App.tsx import { IKeycloakConfiguration, KeycloakProvider, useKeycloak, } from 'expo-keycloak'; import AppConfig from './app.json'; // This is Expo's app json where your scheme should be defined export default () => { const keycloakConfiguration: IKeycloakConfiguration = { clientId: 'AGENT_007', realm: 'REALM_OF_HER_MAJESTY', url: 'http://WHERE_THE_KC_RESIDES', // This is usually an url ending with /auth scheme: AppConfig.expo.scheme, }; return ( <KeycloakProvider {...keycloakConfiguration}> <Auth /> </KeycloakProvider> ); };
Starred by 26 users
Forked by 15 users
Languages   TypeScript
🌐
npm
npmjs.com › package › @alimonia › expo-keycloak-auth
@alimonia/expo-keycloak-auth - npm
expo-auth-session wrapper for keycloak authentication. Latest version: 1.0.21, last published: 2 years ago. Start using @alimonia/expo-keycloak-auth in your project by running `npm i @alimonia/expo-keycloak-auth`. There are no other projects in the npm registry using @alimonia/expo-keycloak-auth.
      » npm install @alimonia/expo-keycloak-auth
    
Published   May 29, 2023
Version   1.0.21
Author   rubhiauliatirtacom, alimonia, tomxpcvx
🌐
Stack Overflow
stackoverflow.com › questions › 76106755 › expo-authsession-keycloak-config
react native - expo authSession keycloak config - Stack Overflow
WebBrowser.maybeCompleteAuthSession(); const useProxy = true; const redirect_uri = AuthSession.makeRedirectUri({ useProxy, }); export default function Index() { // const [isAuthenticated, setIsAuthenticated] = useState(false); const [isReady, setReady] = useState(false); const discovery = AuthSession.useAutoDiscovery( "https://iam.domain/realms/realm" ); // Create and load an auth request const [request, result, promptAsync] = AuthSession.useAuthRequest( { clientId: "vue-id", redirectUri: redirect_uri, scopes: ['openid', 'email', 'offline_access', 'profile'], }, discovery ); return ( <View> <B
Find elsewhere
🌐
GitHub
github.com › PlinioMayer › expo-auth-session-keycloak
GitHub - PlinioMayer/expo-auth-session-keycloak: TypeScript + Expo + Keycloak login
This library is based on JavaScriptJohn/expo-keycloak written in Typescript. It fixes some token refresh bugs and implements offline access. Keycloak authentication for react-native apps using Expo.
Author   PlinioMayer
🌐
npm
npmjs.com › package › expo-keycloak-auth
expo-keycloak-auth - npm
expo-auth-session wrapper for keycloak authentication. Latest version: 1.0.14, last published: 3 years ago. Start using expo-keycloak-auth in your project by running `npm i expo-keycloak-auth`. There are no other projects in the npm registry using expo-keycloak-auth.
      » npm install expo-keycloak-auth
    
Published   Oct 26, 2021
Version   1.0.14
Author   rubhiauliatirtacom
🌐
Gitbook
appcraftman.gitbook.io › myexpenseapp › guide
Guide | MyExpenseApp
in the browser login with default admin/admin account and set up Keycloak realm and Client. Here is an example of client configuration: Follow this steps in this videos to setup authentication:
🌐
Expo Documentation
docs.expo.dev › versions › latest › sdk › auth-session
AuthSession - Expo Documentation
There are many reasons why you might want to handle inbound links into your app, such as push notifications or just regular deep linking (you can read more about this in the Linking); authentication redirects are only one type of deep link, and AuthSession handles these particular links for you. In your own Linking.addEventListener handlers, you can filter out deep links that are handled by AuthSession by checking if the URL includes the +expo-auth-session string -- if it does, you can ignore it.
🌐
Stack Overflow
stackoverflow.com › questions › 73746263 › expo-authsession-with-keycloak-signed-with-letsencrypt-free-ssl-certificate-ret
react native - expo AuthSession with Keycloak signed with letsencrypt free SSL certificate, returns error when trying to exchange code to get JWT on android - Stack Overflow
Here is my code for the authentication flow of keycloak: import React from "react"; import { makeRedirectUri, useAuthRequest, exchangeCodeAsync, CodeChallengeMethod, } from "expo-auth-session"; import { Button, View, StyleSheet } from "react-native"; // WebBrowser.maybeCompleteAuthSession(); const discovery = { authorizationEndpoint: "https://<MY DOMAIN SIGNED BY LETSENCRYPT>/protocol/openid-connect/auth", tokenEndpoint: "https://<MY DOMAIN SIGNED BY LETSENCRYPT>/protocol/openid-connect/token", }; export default function App() { const [secretCode, setSecretCode] = React.useState(""); const [re
🌐
Stack Overflow
stackoverflow.com › questions › tagged › expo-auth-session
Newest 'expo-auth-session' Questions - Stack Overflow
I'm using expo-auth-session package to authenticate using OpenID connect. When the user is in the in-app safari web browser view and enter their email and password and presses login, the "Save ... ... I am developing an ecommerce app for a client and I have had trouble with the authentication process for the application, but only on the Android platform as everything already works as expected on ... ... I'm just upgraded from Keycloak ...
🌐
npm
npmjs.com › package › @anzeblabla › expo-keycloak-auth
@anzeblabla/expo-keycloak-auth - npm
expo-auth-session wrapper for keycloak authentication. Latest version: 1.5.4, last published: 3 months ago. Start using @anzeblabla/expo-keycloak-auth in your project by running `npm i @anzeblabla/expo-keycloak-auth`. There are no other projects in the npm registry using @anzeblabla/expo-keycloak-auth.
      » npm install @anzeblabla/expo-keycloak-auth
    
Published   Jul 23, 2024
Version   1.5.4
Author   rubhiauliatirtacom
🌐
jsDelivr
jsdelivr.com › package › npm › @anzeblabla › expo-keycloak-auth
@anzeblabla/expo-keycloak-auth CDN by jsDelivr - A CDN for npm and GitHub
July 23, 2024 - A free, fast, and reliable CDN for @anzeblabla/expo-keycloak-auth. expo-auth-session wrapper for keycloak authentication
Published   Jul 27, 2022
🌐
Freelancer
freelancer.com › projects › react-native › react-native-expo-keycloak-with
React Native Expo Keycloak with Expo auth-session | Freelancer
React.js & React Native Projects for £20-250 GBP. I need to integrate Keycloak authentication using Expo Auth Session in an Expo app. This needs to have automatic token r
🌐
Npm
npm.io › package › expo-auth-session-keycloak
Expo-auth-session-keycloak NPM | npm.io
This library is based on JavaScriptJohn/expo-keycloak written in Typescript. It fixes some token refresh bugs and implements offline access. Keycloak authentication for react-native apps using Expo.