React Native Integration with OKTA for Authentication

35 Views Asked by At

I am in need of integrating React Native mobile app with OKTA for Authentication with following conditions:-

  1. No browswer based pop-up to be used. The app makes use of it's own native input elements for username and password.
  2. PKCE is to be used
  3. Make use of okta-auth-js library, or even IDX functionality within it.

Requesting if anyone can help.

The error being faced is on Storage ,as described below:-

const myMemoryStore:any = {};
const storageProvider = {
  getItem: function(key : any) {
    // custom get
    return myMemoryStore[key];
  },
  setItem: function(key:any, val:any) {
    // custom set
    myMemoryStore[key] = val;
  },
  // optional
  removeItem: function(key:any) {
    delete myMemoryStore[key];
  }
}

  const authClient = new OktaAuth({
    issuer: value,
    clientId: value',
    redirectUri: value,
    scopes: ['openid','profile','email' ],
    pkce: true,
    storageManager : {
       token : {
         storageProvider : storageProvider,
       }
  })

 async function handleLogin() {
   
   authClient.signInWithCredentials({
         username : value,
       password : value
   })
   .then(function(transaction) {
     console.log('transaction:', JSON.stringify(transaction));
   })
   .catch(function(err) {
     console.error(err);
   });
    }
0

There are 0 best solutions below