oidc-client-js icon indicating copy to clipboard operation
oidc-client-js copied to clipboard

Silent-refresh html called many times

Open sanmscse opened this issue 8 years ago • 9 comments

Hi @brockallen , @kristofdegrave, @bhardwajgaurav007,

i've see the issue id is closed #196(Too many calls in case of silent renew on a slow machine). but it occurs for me.

I've facing the same issue of silent-renew call multi times in the application image

I'm using "oidc-client": "^1.5.0"

also getUser() not loop in to the function immediatley. it userManager.getUser().then(function (user) { var token = user.access_token; } //It debugs here first then after some time only it enters into the function, but before that api call was made.

do we have waittime to wait and execute getuser() first before move to next line?

Warm regards, Saravanan

sanmscse avatar Jun 21 '18 13:06 sanmscse

Not sure what's happening. Can you debug into it some more and let me know what you find?

brockallen avatar Jun 21 '18 13:06 brockallen

Hi @brockallen, @kristofdegrave, @bhardwajgaurav007

the below code is i used for silent callback new UserManager().signinSilentCallback() .then(result => { } ) .catch((err) => { console.log(err); });

this silent-refresh.html called 7 times now including other calls (oidc-client.min.js, authorize?client_id, userinfo all 4 runs a sum of 61 calls) for refreshing access_token.

Also the token updated 7 times in that second.

Warm regards, Saravanan

sanmscse avatar Jun 21 '18 13:06 sanmscse

Hi @brockallen, @kristofdegrave, @bhardwajgaurav007

any update on this

Warm regards, Saravanan

sanmscse avatar Jun 22 '18 11:06 sanmscse

As I said:

Not sure what's happening. Can you debug into it some more and let me know what you find?

I didn't see any more info from you into why it's being called that way.

brockallen avatar Jun 23 '18 13:06 brockallen

Hi,

I even dont know why it called many times "client_id": "sample client id", "response_type": "code id_token token", "scope": "openid profile LoginApi offline_access", "loadUserInfo": true, "automaticSilentRenew": true, "monitorSession": false, "authority": "http://localhost:5000" "redirect_uri": "http://localhost:56352/home", "silent_redirect_uri": "http://localhost:56352/silent-refresh.html", "post_logout_redirect_uri": "http://localhost:56352/login",

the above settings i've set in my json for usersettings and i've set 2mins interval for silent callback for my purpose. But it calls more than 60-120 calls at the time of silent callback begins

Warm regards, Saravanan

sanmscse avatar Jun 25 '18 04:06 sanmscse

Hi @brockallen,

are you able to figure out any solution, i've tried older version "1.3.0" by replace "1.5.0" as well. but it not works.

Warm regards, Saravanan

sanmscse avatar Jun 27 '18 07:06 sanmscse

As per their designs it works only if we create usermanager in one typescript file only it works. so who ever looking solution to this issue; check the object create instance declared only once in your project.

sanmscse avatar Jul 02 '18 04:07 sanmscse

I had the same problem. Silent refresh was called many times when I started my app. It was a bug in my code. When your app is starting for the first time, make sure that you call signinSilent() and you MUST WAIT for the promise to resolve before you try to proceed with the app startup. Otherwise (in my case) the app startup was fetching a lot of stuff concurrently and getting a new token for each call.

jdhenckel avatar Dec 03 '18 20:12 jdhenckel

@sanmscse and @jdhenckel : I am also facing same problem with a silent refresh. can you elaborate more on this issue OR share sample code for this?.

For my project object create instance declared only once in (AuthService) still not working.

Thanks Hiren

patelhirn avatar Mar 31 '20 17:03 patelhirn