okteto / react-oauth2-login

16 stars 1 forks source link

onSuccess onFailure onClick aren't triggered #6

Open georgeyaacoub opened 2 years ago

georgeyaacoub commented 2 years ago

Testing this package, the flow works fine: new OAuth window runs, the user logs in, and is authenticated successfully. but the following logs doesn't run: onSuccess={(response:any)=>console.log('response: ',response)} onFailure={(response:any)=>console.log('response: ',response)} onClick={()=>console.log('onClick={()')} + The generated OAuth window does not close on a success authentication. Can you walk me through that plz

rberrelleza commented 2 years ago

@rlamana could you help out @georgeyaacoub?

rlamana commented 2 years ago

Hi @georgeyaacoub!

If it helps, in https://github.com/okteto/react-oauth2-login/blob/main/example/index.js you have an example of how it should be configured.

georgeyaacoub commented 2 years ago

Hi @georgeyaacoub!

  • onClick is not a defined prop of the LoginOAuth2 component.
  • onSuccess and onFailure, I've been just testing them and they seem to be working fine. Any error in the console? Can you share with us a bit more of your configuration (provider? response type?) passed as props to the component?

If it helps, in https://github.com/okteto/react-oauth2-login/blob/main/example/index.js you have an example of how it should be configured.

Hello @rlamana ! I am trying to use this package to control Successful VS failed statuses from a Google Ads OAuth2 link. What I need to achieve is 2:

Should LoginOAuth2 close the OAuth window on success of failure?

That's how I configured it: <LoginOAuth2 className={''} authorizeUri={'https://accounts.google.com/o/oauth2/v2/auth'} state={'XXXXXXXXXX'} // I had to disable responseType, problem: Property 'responseType' does not exist on type 'IntrinsicAttributes & LoginOAuth2Props & { children?: ReactNode; } // responseType={'code'} clientId={'xxxxx-xxxxxxx.apps.googleusercontent.com'} redirectUri={'http%3A%2F%2Fgrower.local.com%3A3033%2Fapi%2Fgoogle-ad%2Fcallback'} scope={'https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fadwords+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email'} // buttonText disabled, same as responseType // buttonText={'button text here'} onSuccess={(response:any)=>console.log('response: ',response)} onFailure={(response:any)=>console.log('response: ',response)} params={{ prompt: 'consent' }} />