bjerkio/oidc-react

UserManager not working?

resting opened this issue · 1 comments

Was trying to figure how UserManager works, so I copied the config from AuthProvider to UserManger like this:

const config = {
  authority: 'https://accounts.google.com',
  clientId:
    '1066073673387-undfdseanu1soilcdprq1p4m8gq8a1iu.apps.googleusercontent.com',
  responseType: 'id_token',
  redirectUri:
    process.env.NODE_ENV === 'development'
    ? 'http://localhost:3000/'
    : 'https://cobraz.github.io/example-oidc-react',
}

const oidcConfig = {
  onSignIn: async (user: any) => {
    alert('You just signed in, congratz! Check out the console!');
    console.log(user);
    window.location.hash = '';
  },
  userManager: new UserManager(config)
  // authority: 'https://accounts.google.com',
  // clientId:
  //   '1066073673387-undfdseanu1soilcdprq1p4m8gq8a1iu.apps.googleusercontent.com',
  // responseType: 'id_token',
  // redirectUri:
  //   process.env.NODE_ENV === 'development'
  //     ? 'http://localhost:3000/'
  //     : 'https://cobraz.github.io/example-oidc-react',
};

Then the app stops redirecting, what am I missing?

Example from: https://github.com/cobraz/example-oidc-react

I figured, the config fields where wrong. It works with these:

const config = {
  authority: 'https://accounts.google.com',
  client_id:
    '1066073673387-undfdseanu1soilcdprq1p4m8gq8a1iu.apps.googleusercontent.com',
  response_type: 'id_token',
  redirect_uri:
    process.env.NODE_ENV === 'development'
    ? 'http://localhost:3000/'
    : 'https://cobraz.github.io/example-oidc-react',
}