Open kennyho-ml opened 3 years ago
Hi @kennyho-ml can you make sure the response is not null by using a print statement?
Hi @kennyho-ml can you make sure the response is not null by using a print statement?
@JayNewstrom I'm not able to get print the response ..as it's throwing an error ... I get
{ [TypeError: null is not an object (evaluating '_reactNative.NativeModules.OktaSdkBridge.authenticate')]
line: 110740,
column: 87,
sourceURL: 'http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.oktaandroidtest&modulesOnly=false&runModule=true' }
when printing the error.
What does this print?
const response = await getAuthClient().signInWithCredentials({username, password})
console.log(response)
What does this print?
const response = await getAuthClient().signInWithCredentials({username, password}) console.log(response)
@JayNewstrom
{"cancel": [Function anonymous], "data": {"_embedded": {"user": [Object]}, "_links": {"cancel": [Object]}, "expiresAt": "2021-10-13T16:11:28.000Z", "sessionToken": "20111bvGnQPruqwMDsYC63FJEKRnwiQ40WPRcWWDiUSvgQ38LIOU3S1", "status": "SUCCESS"}, "expiresAt": "2021-10-13T16:11:28.000Z", "sessionToken": "20111bvGnQPruqwMDsYC63FJEKRnwiQ40WPRcWWDiUSvgQ38LIOU3S1", "status": "SUCCESS", "user": {"id": "00u27hp8vtU9IDa3s5d7", "passwordChanged": "2021-10-13T13:20:23.000Z", "profile": {"firstName": "mary", "lastName": "poppins", "locale": "en", "login": "marypoppinsatml@gmail.com", "timeZone": "America/Los_Angeles"}}}
Also .. I created my own personal okta instance... and I'm getting
[Error: Okta Oidc error]
when doing:
const onSubmit = async () => {
try {
const response = await getAuthClient().signInWithCredentials({
username,
password,
});
console.log('response: ', response);
const {sessionToken} = response;
console.log('SESSION TOKEN: ', sessionToken);
const resp = await authenticate({sessionToken: sessionToken});
console.log('AUTHENTICATE, ', resp);
} catch (e) {
console.log('ERROR : ', e);
}
};
Not sure if this might help.
@kennyho-ml which line is failing with [Error: Okta Oidc error]
?
Is it the getAuthClient().signInWithCredentials
line?
@kennyho-ml which line is failing with
[Error: Okta Oidc error]
?Is it the
getAuthClient().signInWithCredentials
line? @JayNewstrom nope..await authenticate({sessionToken})
What does your log for this line return?
console.log('SESSION TOKEN: ', sessionToken);
Is it a valid token?
What does your log for this line return?
console.log('SESSION TOKEN: ', sessionToken);
Is it a valid token?
I assume so .. 'SESSION TOKEN: ', '20111bvGnQPruqwMDsYC63FJEKRnwiQ40WPRcWWDiUSvgQ38LIOU3S1'..
For IOS I get
I'm not sure why android doesn't have parity like so. .. (Getting to the requests past authn
)
Here are the configs for android/app/build.gradle
as well ... as I thought it might have to do something with the redirect
def nativeArchitectures = project.getProperties().get("reactNativeDebugArchitectures")
android {
ndkVersion rootProject.ext.ndkVersion
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "com.oktaandroidtest"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
manifestPlaceholders = [
appAuthRedirectScheme: 'com.oktaandroidtest'
]
}
...
I've created an internal issue for us to take a look at this. OKTA-437013
Judging by what you've provided, it looks like a bug. If you have a chance, could you show the network logs for the Android version as well.
I've created an internal issue for us to take a look at this. OKTA-437013
Judging by what you've provided, it looks like a bug. If you have a chance, could you show the network logs for the Android version as well.
Here are the logs:
Device Logs:
Network Logs:
Hey @kennyho-ml
Is there a reason to use await getAuthClient().signInWithCredentials
?
I believe you can use a convenience method signIn
, it does the same but in one line without needing to exchange session token.
I'm not sure if it fixes the issue but still it's the SDK way to authenticate with creds.
@oleggnidets-okta hi -- we used signInWithCredentials
because it exposed the deviceId
which allows you to remember the device and skip MFA... It shouldn't matter though since we get the sessionToken
either way to call authenticate
?
-- also it said https://github.com/okta/okta-auth-js#signinoptions was being deprecated.. I think that was also one of our reasons.
Having the same issue here has there been any movement on this?
I was able to get a more detailed error back from the module [Hardware Backed KeyStore. Client require hardware backed keystore, but EncryptionManager doesn't support it.]
I'm submitting a:
Current behavior
I'm using the Js wrapper to login => get a sessionToken => use authenticate with session Token
On IOS, this works as expected as I see the network requests via Flipper that is calling the authn endpoints. Then after you call
authenticate
it callsauthorize
which sets thesid
cookie.❗ However on android, when you call
authenticate
it seems like it's rejecting a promise (which maybe why it doesn't callauthorize
Here are the logs
Expected behavior
Able to call
authenticate
on android and have thesid
cookie set on the device. (just for reference... I'm using sid cookie to SSO into zendesk).Minimal reproduction of the problem with instructions
Creating new react-native app and install new okta... via
Config taken from https://github.com/okta/okta-react-native#createconfig:
Okta calls:
Extra information about the use case/user story you are trying to implement
Environment
node -v
): 14.18.0