react-keycloak / react-native-keycloak Goto Github PK
View Code? Open in Web Editor NEWReact Native components for Keycloak
License: MIT License
React Native components for Keycloak
License: MIT License
When I run in emulator Pixel 5 API 30 (Androud 11 Google APIs), there is a error: "Error: InAppBrowser not available". (like below image), but when I use physical device (Android 11), there's no problem with InAppBrowser here, but after I login, keycloak?.authenticated still returns false. I wonder that there is any issue here or I forgot any step. I would appreciate any suggestions.
Here is some config file following instructions:
Getting error while authenticating using keycloak:
[TypeError: Object.fromEntries is not a function. (In 'Object.fromEntries(oAuthParams.entries())', 'Object.fromEntries' is undefined)]
Solution Tried:
I tired to use a plugin to fix this issue:
https://www.npmjs.com/package/babel-plugin-transform-object-from-entries , but issue was still not resolved.
I guess the issue here is that: object.fromentries is not supported by many js engine. May be we need a alternative for this or any other solution.
Versions used:
node: v12.18.3
react: ~16.9.0
@react-keycloak/native: "^0.5.1"
react-native-inappbrowser-reborn: "^3.5.1"
react-native: "^0.63.3"
Please provide help here. Thanks in advance.
@IronTony @panz3r
Describe the bug
When passing a redirectUri
to the logout
method, there is a promise rejection with the error: Logout flow failed
To Reproduce
redirectUri
to the logout
method.await keycloak?.logout({ redirectUri:
${KEYCLOAK_REDIRECT_URI}onBoarding, })
Expected behavior
When logging out have the event handled by the provider and not an unhandled promise.
Smartphone
ALL
good night,
I know that is not the focus .. but I have this problem when I make 1 request after login ...
what could be going wrong?
thank you
`const lista = () => {
const [isLoading, setLoading] = useState(true);
const [data, setData] = useState([]);
useEffect(() => {
fetch('GET', 'http://192.168.0.102:8082/agendas/ativas', {
'Content-Type': 'application/json',
})
.then((response) => response.json())
.then((json) => setData(json.agendas))
.catch((error) => console.error(error))
.finally(() => setLoading(false));
}, []);
return (
<View style={{ flex: 1, padding: 24 }}>
{isLoading ? <ActivityIndicator/> : (
<FlatList
data={data}
keyExtractor={({ id }, index) => id}
renderItem={({ item }) => (
<Text>{item.nome}, {item.cor}</Text>
)}
/>
)}
</View>
);
};
export default lista`
Describe the bug
When using keycloak.login()
it goes to an url with a query parameter &adapter=function+RNAdapter%28client%2C+_keycloakConfig%2C+initOptions%29+%7B%0A++++++%280%2C+_classCallCheck2.default%29%28this%2C+RNAdapter%29%3B%0A++++++this.client+%3D+client%3B%0A++++++this.initOptions+%3D+initOptions%3B%0A++++%7D
, this results in a 502 Bad Gateway
response.
To Reproduce
Expected behavior
Screenshots
Smartphone
Additional context
After enabling Proguard, the keycloak stopped working, the webview doesn't open anymore. Is there any configuration I should do?
Hi!
After the login method, i receive 3 tokens provided by onTokens handler function:
but no one of these is the access token that i need for authenticate my http calls.
Any suggest?
Thanks
onTokenExpired callback is not invoking properly very first time once the token got expired. However, it's working fine for next time. For example:- if the token expired time is 5 minutes then it will invoke in 10 minutes(2x times) first time, after that it would be invoked in every 5 minutes.
keycloak.onTokenExpired = () => { keycloak?.updateToken(240).then((refreshed) => { if (refreshed && keycloak.token) { Alert.alert('Token was successfully refreshed12'); } else { Alert.alert('Token is still valid'); }}).catch(() => { Alert. alert('Failed to refresh the token, or the session has expired); }); };
It should invoke every 5 minutes if the token expired time is 5 minutes.
Thank You
Describe the bug
To Reproduce
Expected behavior
Screenshots
Smartphone
Additional context
Describe the bug
After login successful from the browser, I'm getting [Error: SyntaxError: JSON Parse error: Unrecognized token '<']
Previously everything was working correctly, but it stopped working.
The error is not from keycloak side, because I'm able to login and then redirected to the mobile app. So probably some parsing error? It's trying to parse HTML page? I'm also able to use PostMan to get access_token
using password
as grant_type
.
Package Versions :
@react-keycloak/native
: ^0.5.1
react-native-inappbrowser-reborn
: ^3.4.0
react-native
: 0.62.2
Thanks for the repo ⚡
Describe the bug
Trying to log in using a iOS 14.5 device throws the following exception and crashes the app.
My options look like:
initOptions={{
redirectUri: 'myapp://home',
inAppBrowserOptions: {
modalPresentationStyle: 'fullScreen',
enableBarCollapsing: false,
modalEnabled: true,
ephemeralWebSession: true,
dismissButtonStyle: 'ok',
},
}}
Everything works fine on iOS 14.4 or below.
To Reproduce
await keycloak?.login();
Expected behaviour
To be able to open the browser with no error.
Screenshots
Smartphone
Additional context
Describe the bug
To Reproduce
public
Standard only
myapp://Homepage
S256
<ReactNativeKeycloakProvider
authClient={keycloak}
initOptions={{
redirectUri: 'myapp://Homepage',
pkceMethod: 'S256',
inAppBrowserOptions: {
},
}}
>
<Login />
</ReactNativeKeycloakProvider>
Expected behavior
React-native keycloak should pass in the parameter code_challenge_method.
Screenshots
Error screenshots:
Keycloak client settings screenshots (zoom in if can't see first image):
Code screenshots:
Smartphone
Hi, I'm new with autentication in keycloak.
Right now I can open the browser to enter the credentials, but when tap on Log in
this page send me to inside of console of keycloak, but I need close the browser and return me to my app.
Maybe some one can explain me how can I do that.
Because I know I can modify the field valid redirect uris inside of console of keycloak, but I don't sure what path I should put there for return me to my app.
Describe the bug
Hi
After successful authentication, I am receiving the error that follows in the print below.
Thank you for your help.
Screenshots
To Reproduce
My Navigator component:
const AuthStack: React.FC = () => {
const { Navigator, Screen } = createStackNavigator();
return (
<Navigator>
<Screen name="signinkeycloak" component={SignInKeycloak} />
</Navigator>
);
};
My Keycloack configuration:
<ReactNativeKeycloakProvider
LoadingComponent={<Text>Loading</Text>}
authClient={keycloak}
initOptions={{
redirectUri: 'myapp://signinkeycloak',
inAppBrowserOptions: {
modalPresentationStyle: 'fullScreen',
enableBarCollapsing: false,
modalEnabled: true,
ephemeralWebSession: true,
dismissButtonStyle: 'ok',
},
}}>
<NavigationContainer linking={linking}>
<ContextProvider>
<StatusBar barStyle="dark-content" backgroundColor="#FFF" />
<Routes />
</ContextProvider>
</NavigationContainer>
</ReactNativeKeycloakProvider>
Hi Team
When i click the login button from simulater I am getting below error
Possible Unhandled Promise Rejection (id: 0):
Error: InAppBrowser not available
login$@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:112920:32
tryCatch@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:112128:23
invoke@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:112298:32
tryCatch@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:112128:23
invoke@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:112200:30
http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:112210:21
tryCallOne@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:29348:16
http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:29449:27
_callTimer@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:32960:17
_callImmediatesPass@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:32996:19
callImmediates@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:33215:33
callImmediates@[native code]
__callImmediates@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:2538:35
http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:2323:34
__guard@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:2521:15
flushedQueue@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:2322:21
flushedQueue@[native code]
invokeCallbackAndReturnFlushedQueue@[native code]
Please see the attached Screen shot. Please help me to resolve this
Describe the bug
When logging on iOS, and then killing the app, the next time you open it, it asks you to login again.
On Android, chrome keeps the cookies.
I'm using the login-required
option of keycloak.
Thore are the initOptions
initOptions={{
redirectUri: ${KEYCLOAK_REDIRECT_URI}home,
responseMode: 'query',
onLoad: 'login-required',
inAppBrowserOptions: {
// For iOS check: https://github.com/proyecto26/react-native-inappbrowser#ios-options
// For Android check: https://github.com/proyecto26/react-native-inappbrowser#android-options
// Android Properties
showTitle: false,
toolbarColor: '#006199',
secondaryToolbarColor: 'black',
enableUrlBarHiding: true,
enableDefaultShare: false,
forceCloseOnRedirection: true,
hasBackButton: true,
showInRecents: false,
},
}}
To Reproduce
Expected behavior
If the session is valid, do the login automatically as on Android.
Smartphone
All iOS Devices
Additional context
I think is an issue with the inAppBrowser, if so, any workaround?
If I have to use the check-sso
option, how to handle the cookies with the silent option?
How to "link" the html file with the iframe?
Describe the bug
Firstly really appreciate the lib but I've noticed, once the user kills the app after logging in, next time they open the app it doesn't recognize the user is logged in.
Is there something I'm missing?
Describe the bug
When trying to run the example. I get error:
error: Error: Unable to resolve module `@babel/runtime/helpers/interopRequireDefault` from `../src/index.ts`: @babel/runtime/helpers/interopRequireDefault could not be found within the project.
If you are sure the module exists, try these steps:
1. Clear watchman watches: watchman watch-del-all
2. Delete node_modules: rm -rf node_modules and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
To Reproduce
cd example
yarn install
cd ios
pod install
yarn start
yarn run ios
Expected behavior
Runs the example
Smartphone
Android (emulator) + iPhone 11
Additional context
The example is probably outdated?
I am executing your example and when i build, I am facing an issue
"Execution failed for task ':app:processDebugResources'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Android resource linking failed
D:\Projects\app\mapp\node_modules\react-native-inappbrowser-reborn\android\build\intermediates\library_manifest\debug\AndroidManifest.xml:14:5-18:15: AAPT: error: unexpected element found in ."
Describe the bug
Can't handle the promise rejection when pressing the back/close
icon of the in-app browser.
To Reproduce
black/close
iconPossible Unhandled Promise Rejection (id: 0):
Error: Authentication flow failed
Expected behavior
I would like to have a method to handle the rejections of this Promise.
Smartphone
ALL
Additional context
Can't handle the error via the onEvent
callback as it wraps only the event from Keycloak.
Hi there!
I have integrated this library in my client and it was working fine, then I had to change endpoints to point to the new server we have on google cloud and something seems to have broken, it looks like I do get logged in, I can see it from keycloak console, but instead of getting the event onAuthSuccess I get onAuthError and of course I don't get the tokens. Unfortunately the error message doesn't say much 'Network request failed' and I can't understand what's going on.
This happens after calling Keycloak.login(), the webview opens up, I put in my credentials, everything seems to work just fine, but when the webview closes and I get back to the app I get the above error event.
I'm testing on a Pixel 3a with Android version 10
Any help would be very appreciated!
Describe the bug
Recieving a warning after authenticating.
WARN: Setting a timer for a long period of time, i.e. multiple minutes, is a performance and correctness issue on Android as it keeps the timer module awake, and timers can only be called when the app is in the foreground. See facebook/react-native#12981 for more info.
(Saw setTimeout with duration 299418.9999103546ms)
To Reproduce
Expected behavior
No warning to appear, or use a different method of requesting for a token refresh.
Smartphone
Additional context
https://github.com/react-keycloak/keycloak-ts/blob/42637a6fe47e3714a4ebbd6abefb2c2fd63f19c0/src/client.ts#L887-L890
Is there any way to disable Dialog asking for sign-in permissions?
how is the compatibility with class component?
i was facing this problem which i have the version of "react-native": "0.61.2" and "@react-keycloak/native": "^0.5.2" but throws me a warning of promise unhandled.
it It a compatibility problem?
I have an issue about chrome process. Looks like if I terminate Chrome, it will terminate all process include browser in app.
Reproduce:
Expected behavior:
Keep process in app and auto login.
Smartphone
All android.
iOS not tested.
Hello
I still haven't been able to implement it .. I log in and I'm not redirected to the app. can you be more direct in the documentation? so no one will use your library.
thank you.
I believe I am running into an issue with linking on Android. It seems to be the #state=...
portion that is throwing react-navigation
off from picking up the link. Testing deeping linking works via CLI: npx uri-scheme open io.act.auth://CreateCheckin --android
.
Heres is my linking config:
prefixes: ["io.act.auth://"],
config: {
screens: {
CreateCheckin: {
path: "CreateCheckin"
}
}
}
Here is the redirect URI that react-navigation
is trying to parse:
io.act.auth://CreateCheckin#state=978f7de7-42a1-424d-bacd-53a746c030ab&session_state=0436a428-d734-490f-a3bc-812712458efd&code=6627fcff-abac-4139-99b7-54ed2d2a9fee.0436a428-d734-490f-a3bc-812712458efd.011ac3f2-b54f-419d-8108-6b1b67bd3f12
What would be the proper config to match the #state...
portion?
Originally posted by @joe307bad in #27 (comment)
How can I persist the Keycloak instance? Can I use Async Storage or I have to use local storage?
Hi
I am getting below error after successful authentication, causing the hindrance in redirection to homepage:
Possible Unhandled Promise Rejection (id: 2):
Invariant Violation: InAppBrowser.openAuth is in a bad state. _redirectHandler is defined when it should not be.
Sometimes the above error is not there and authentication is successful but tokens are undefined.
Please help with this.
Thanks in advance.
At the moment I have:
keycloak.js
import { RNKeycloak } from '@react-keycloak/native'
// Setup Keycloak instance as needed
// Pass initialization options as required
const keycloak = new RNKeycloak({
url: 'https://MY_URL/auth/',
realms: 'MY_REALM',
realm: 'MY_REALM',
clientId: 'MY_CLIENTID',
account: 'MY_CLIENTID',
// if you need to customize "react-native-inappbrowser-reborn" View you can use the following attribute
inAppBrowserOptions: {
// For iOS check: https://github.com/proyecto26/react-native-inappbrowser#ios-options
// For Android check: https://github.com/proyecto26/react-native-inappbrowser#android-options
}
})
export default keycloak
app.js
import keycloak from './keycloak'
function App () {
return (
<ReactNativeKeycloakProvider
authClient={keycloak}
initOptions={{ redirectUri: 'https://MY_URL/auth/realms/MY_REALM/MY_CLIENTID/login-redirect'}}
>
<Provider store={store}>
<Routes />
</Provider>
</ReactNativeKeycloakProvider>
)
}
With this current code, when I try to execute the method:
keycloak?.login()
the app show me the alert:
Until this step, everything is great, but when will to open the browser use a URL wrong.
URL WORNG: https://MY_URL/auth/realms/MY_REALM/protocol/openid-connect/auth?client_id=MY_CLIENTID&redirect_uri=https%3A%2F%2FMY_URL%2Fauth%2Frealms%2FMY_REALM%2Faccount%2Flogin-redirect&**state=e3c614f2-53de-4fdf-886e-52223915bac6&response_mode=fragment**&response_type=code&scope=openid
until attribute redirect_uri
is ok, but when start the attribute state
all change.
Where I need to send mi is:
URL I NEED: https://MY_URL/auth/realms/MY_REALM/protocol/openid-connect/auth?client_id=MY_CLIENTID&redirect_uri=https%3A%2F%2FMY_URL%2Fauth%2Frealms%2FMY_REALM%2Faccount%2Flogin-redirect&state=0%2F79fbc5e0-c70d-4eef-bf5d-ed6c9b6b555e&response_type=code&scope=openid
so, any idea how I can customize the attribute state
and remove response_mode
from wrong url?
Thank you for the excellent repo and excellent documentation.
I have configured everything and in the debug APK everything works fine, but when I create a build APK and try to test it, authentication fails after the redirect to app.
I tried to print the error msg in the build version, I'm getting following :
{"line" : "992" , "column" : 11311, "sourceURL" : "index.android.bundle"}
I tried recreating the bundle and also managing assets. But I'm getting same problem.
Hi,
Thank u for your work. The example in example
directory seems incomplete.
Can you provide a simple "complete" example please?
Thanks in advance.
I need to get access_token from keycloak.
Currently, I am getting grant_type = client_credentials and client_id, client_secret;
But due to some system requirements we need to use implicit flow. But I can't get the password so I can't get the token with grant_type = password.
I use react native and am using curl to get tokens. Is there any solution that can help me? Please?
on keycloak.login(), it's taking me to server's login web view. After logging in it's taking me back to App. The problem I am facing is that I am unable to get Token from keycloak using usekeycloak() hook.
const {keycloak} = useKeycloak();
console.log(keycloak.token);
Please help, I will be thankful to you.
Hi! First of all, I really appreciate your service.
I have a question about maintaining login after app restart.
This is my senario.
In this senario, when I get keycloak instance from a useKeycloak hooks after restarting my app, there is no access token & refresh token in keycloak instance.
I want to use a keycloak instance just like when I first login(not only use stored access token & refresh token).
Is there the way initialize keycloak instance including stored access token & refresh token after restarting my app without login?
Thank you.
Hello Friend.
thanks for the library.
I was a little confused ... because I am implementing and via the browser the link localhost: 8080 / auth of the keycloak I can access ...
however if I try to do this through my emulator of the android app .. it does not access the page .. what is the problem?
my keycloak.js is
`
import { RNKeycloak } from '@react-keycloak/native';
// Setup Keycloak instance as needed
// Pass initialization options as required
const keycloak = new RNKeycloak({
realm: "XXXXX",
url: "http://localhost:8080/auth",
clientId: 'ui',
});
export default keycloak;`
This is the code now in the adapter.ts
file:
const res = await InAppBrowser.openAuth(
loginUrl,
this.client.redirectUri!,
this.initOptions.inAppBrowserOptions
);
if (res.type === 'success' && res.url) {
const oauth = this.client.parseCallback(res.url);
return this.client.processCallback(oauth);
}
throw new Error('Authentication flow failed');
I believe the module should throw a specific exception when the user closes the InAppBrowser:
const res = await InAppBrowser.openAuth(
loginUrl,
this.client.redirectUri!,
this.initOptions.inAppBrowserOptions
);
if (res.type === 'success' && res.url) {
const oauth = this.client.parseCallback(res.url);
return this.client.processCallback(oauth);
}
+if (res.type === 'close') {
+ throw new Error('User has closed the browser')
+}
throw new Error('Authentication flow failed');
Describe the bug
I have followed the instructions and the authentication flow seems to not working correctly on android (on ios works fine).
I'm getting the following error:
WARN EventEmitter.removeListener('url', ...): Method has been deprecated. Please instead use `remove()` on the subscription returned by `EventEmitter.addListener`.
WARN Possible Unhandled Promise Rejection (id: 0):
Error: Authentication flow failed
login$@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=gr.app&modulesOnly=false&runModule=true:108519:32
tryCatch@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=gr.app&modulesOnly=false&runModule=true:23399:23
invoke@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=gr.app&modulesOnly=false&runModule=true:23569:32
tryCatch@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=gr.app&modulesOnly=false&runModule=true:23399:23
invoke@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=gr.app&modulesOnly=false&runModule=true:23471:30
http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=gr.app&modulesOnly=false&runModule=true:23481:21
tryCallOne@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=gr.app&modulesOnly=false&runModule=true:28074:16
http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=gr.app&modulesOnly=false&runModule=true:28175:27
http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=gr.app&modulesOnly=false&runModule=true:28690:26
_callTimer@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=gr.app&modulesOnly=false&runModule=true:28586:17
_callImmediatesPass@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=gr.app&modulesOnly=false&runModule=true:28625:17
callImmediates@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=gr.app&modulesOnly=false&runModule=true:28835:33
__callImmediates@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=gr.app&modulesOnly=false&runModule=true:3052:35
http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=gr.app&modulesOnly=false&runModule=true:2830:34
__guard@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=gr.app&modulesOnly=false&runModule=true:3035:15
flushedQueue@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=gr.app&modulesOnly=false&runModule=true:2829:21
flushedQueue@[native code]
invokeCallbackAndReturnFlushedQueue@[native code]
To Reproduce
My configuration:
// Setup Keycloak instance as needed
// Pass initialization options as required
const keycloak = new RNKeycloak({
url: 'https://sso.test.io/auth/',
realm: 'test',
clientId: 'test',
});
const initOptions = {
redirectUri: 'app://Homepage',
// if you need to customize "react-native-inappbrowser-reborn" View you can use the following attribute
inAppBrowserOptions: {
// For iOS check: https://github.com/proyecto26/react-native-inappbrowser#ios-options
// For Android check: https://github.com/proyecto26/react-native-inappbrowser#android-options
},
};
const App = () => (
<ReactNativeKeycloakProvider authClient={keycloak} initOptions={initOptions}>
<NativeRouter>
<Route exact path="/" component={Home} />
<Route path="/video" component={Video} />
</NativeRouter>
</ReactNativeKeycloakProvider>
);
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="gr.app">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="app" />
</intent-filter>
</activity>
</application>
</manifest>
Expected behavior
Smartphone
how to pass client-secret to get token and access data?
We save the session/cookies by using ephemeralWebSession: false
then if user reinstalls the application again then session won't clear. But in most of the scenarios user should enter his/her credentials to login into the app.
So can we clear the session if the user reinstalls the application on his device?
i already added scheme myapp name on mainfest. but still not work after authorize, response still not reponse to app, can you make it example configure
Hello everyone, I have a server with Access Type confidential and I need to send the secret key to authenticate correctly. I didn't find in the documentation how to send this field correctly. Can someone help me?
Thanks in advance.
Describe the bug
In some cases, when the user wants to change accounts in social login, the library takes the data of the last authenticated account.
Is there a way to clear the session in authentication with social login?
Describe the bug
Hi Keycloak team, thank you very much for providing this library. I could login using keycloak account, so it worked. I only have an issue with empty token. My problem is as below:
I am implementing keycloak auth for react native app. And I am having problem with onTokens giving empty token list. Even thought onEvent was triggered with onAuthSuccess
Here is my keycloak client
import { RNKeycloak } from '@react-keycloak/native';
const keycloak = new RNKeycloak({
url: 'https://MYDOMAIN/auth',
realm: 'MYREALM',
clientId: 'account',
});
export default keycloak;
Implemented keycloak provider in root top App as below
<ReactNativeKeycloakProvider
authClient={keycloak}
initOptions={{
redirectUri: 'MYAPP://auth',
inAppBrowserOptions: {},
}}
onEvent={(event, error) => {
console.log('=======>keycloak onEvent', event, error);
}}
onTokens={(tokens) => {
console.log('=========>keycloak onTokens', tokens);
}}
>
...
A login button which triggers keycloak.login as below:
...
const LoginWithKeycloak = ({ label, type, onSuccess, onError }) => {
const { keycloak } = useKeycloak();
const handleLogin = () => {
keycloak?.login(
{
prompt: 'login',
}).then(() => {
if (onSuccess) onSuccess();
})
.catch((error) => {
if (onError) onError(error);
})
};
...
upon onSuccess it will navigate to next screen
To Reproduce
Expected behavior
onTokens to return valid tokens instead of undefined
Screenshots
Log of events could be captured as below
Smartphone
I am using Google identity provider, by calling keycloak.login({idpHint: 'google'})
function, a new user gets created successfully on keycloak admin console, but I am unable to get its access token. The call for access token is being made internally by this package. Is there a way to provide clientSecret to the KeyCloak?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.