manishrasrani / ms-adal-angular6

This is a wrapper library for Angular 6+ (Angular 6.X.X and Angular 7.X.X) modules over Microsoft ADAL (Azure Active Directory Authentication Library)
https://www.npmjs.com/package/microsoft-adal-angular6
MIT License
34 stars 13 forks source link

how to use RenewToken method? #23

Open PradeepThalodil opened 5 years ago

PradeepThalodil commented 5 years ago

I would like to know, how should I use RenewToken method. There is no documentation. I am using Implicit Grant Flow, and I need to renew the token before the access token expires. There is no sample code available to achieve this task on internet. I tried to call the RenewToken method like this but I am getting 'undefined'.

const token = this.adalSvc.RenewToken('https://graph.microsoft.com'); alert(token);

prashant214 commented 5 years ago

I would like to know, how should I use RenewToken method. There is no documentation. I am using Implicit Grant Flow, and I need to renew the token before the access token expires. There is no sample code available to achieve this task on internet. I tried to call the RenewToken method like this but I am getting 'undefined'.

const token = this.adalSvc.RenewToken('https://graph.microsoft.com'); alert(token);

Any luck Pradeep I am also facing similar issue token expires and I am not able to renew that.

PradeepThalodil commented 5 years ago

Hi Prashant,

I have provided the solution in the same question thread. I am not sure why you are not able to view. please verify if you are reading the following question thread

https://stackoverflow.com/questions/56802233/how-to-use-renewtoken-method-of-msadal-in-angular-6?noredirect=1#comment100163004_56802233

Regards Pradeep

On Thu, Jul 4, 2019 at 1:04 PM prashant214 notifications@github.com wrote:

I would like to know, how should I use RenewToken method. There is no documentation. I am using Implicit Grant Flow, and I need to renew the token before the access token expires. There is no sample code available to achieve this task on internet. I tried to call the RenewToken method like this but I am getting 'undefined'.

const token = this.adalSvc.RenewToken('https://graph.microsoft.com'); alert(token);

Any luck Pradeep I am also facing similar issue token expires and I am not able to renew that.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/manishrasrani/ms-adal-angular6/issues/23?email_source=notifications&email_token=AB3HWDJHCQHJDFWNILYH5RLP5WRWVA5CNFSM4H4DEOCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZGSZFI#issuecomment-508374165, or mute the thread https://github.com/notifications/unsubscribe-auth/AB3HWDMXNWFWZTVQK32G2L3P5WRWVANCNFSM4H4DEOCA .

prashant214 commented 5 years ago

Hi Prashant, I have provided the solution in the same question thread. I am not sure why you are not able to view. please verify if you are reading the following question thread https://stackoverflow.com/questions/56802233/how-to-use-renewtoken-method-of-msadal-in-angular-6?noredirect=1#comment100163004_56802233 Regards Pradeep On Thu, Jul 4, 2019 at 1:04 PM prashant214 @.***> wrote: I would like to know, how should I use RenewToken method. There is no documentation. I am using Implicit Grant Flow, and I need to renew the token before the access token expires. There is no sample code available to achieve this task on internet. I tried to call the RenewToken method like this but I am getting 'undefined'. const token = this.adalSvc.RenewToken('https://graph.microsoft.com'); alert(token); Any luck Pradeep I am also facing similar issue token expires and I am not able to renew that. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#23?email_source=notifications&email_token=AB3HWDJHCQHJDFWNILYH5RLP5WRWVA5CNFSM4H4DEOCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZGSZFI#issuecomment-508374165>, or mute the thread https://github.com/notifications/unsubscribe-auth/AB3HWDMXNWFWZTVQK32G2L3P5WRWVANCNFSM4H4DEOCA .

Hi tried this but this is taking user to login screen. Basically user is getting logged out.

PradeepThalodil commented 5 years ago

what browser are you using? Log out should not happen, because the renewal is done through hidden IFRAME. If the renewal happens outside IFRAME, then you might see logout.

Rgds Pradeep

On Mon, Jul 8, 2019 at 12:31 PM prashant214 notifications@github.com wrote:

Hi Prashant, I have provided the solution in the same question thread. I am not sure why you are not able to view. please verify if you are reading the following question thread https://stackoverflow.com/questions/56802233/how-to-use-renewtoken-method-of-msadal-in-angular-6?noredirect=1#comment100163004_56802233 Regards Pradeep … <#m6306578608197028946> On Thu, Jul 4, 2019 at 1:04 PM prashant214 @.***> wrote: I would like to know, how should I use RenewToken method. There is no documentation. I am using Implicit Grant Flow, and I need to renew the token before the access token expires. There is no sample code available to achieve this task on internet. I tried to call the RenewToken method like this but I am getting 'undefined'. const token = this.adalSvc.RenewToken(' https://graph.microsoft.com'); alert(token); Any luck Pradeep I am also facing similar issue token expires and I am not able to renew that. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#23 https://github.com/manishrasrani/ms-adal-angular6/issues/23?email_source=notifications&email_token=AB3HWDJHCQHJDFWNILYH5RLP5WRWVA5CNFSM4H4DEOCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZGSZFI#issuecomment-508374165>, or mute the thread https://github.com/notifications/unsubscribe-auth/AB3HWDMXNWFWZTVQK32G2L3P5WRWVANCNFSM4H4DEOCA .

Hi tried this but this is taking user to login screen. Basically user is getting logged out.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/manishrasrani/ms-adal-angular6/issues/23?email_source=notifications&email_token=AB3HWDJWGPE37IVXGEGXVIDP6LQ6PA5CNFSM4H4DEOCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZMFDXQ#issuecomment-509104606, or mute the thread https://github.com/notifications/unsubscribe-auth/AB3HWDMSSRI26U3YI6N5UXLP6LQ6PANCNFSM4H4DEOCA .

prashant214 commented 5 years ago

This issue is resolved for me. I have used acquireToken() to get the new token . In acquireToken() I am passing my application client ID.

PradeepThalodil commented 5 years ago

Okay Great! :)

On Wed, Jul 10, 2019 at 2:26 PM prashant214 notifications@github.com wrote:

This issue is resolved for me. I have used acquireToken() to get the new token . In acquireToken() I am passing my application client ID.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/manishrasrani/ms-adal-angular6/issues/23?email_source=notifications&email_token=AB3HWDPOT4X32LZQMWYDZFLP6WP3ZA5CNFSM4H4DEOCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZSZRQY#issuecomment-509974723, or mute the thread https://github.com/notifications/unsubscribe-auth/AB3HWDN6I7S5VEZRPTLTZDTP6WP3ZANCNFSM4H4DEOCA .

PradeepThalodil commented 5 years ago

Hi Prashant,

I have updated my answer to include the acquireToken() method call. In my case, I have to call RenewToken() and acquireToken(). Following is the code I have written.

getNewToken() { this.newadalsvc.RenewToken('https://graph.microsoft.com'); this.newadalsvc.acquireToken('https://graph.microsoft.com').subscribe((token) => { console.log('Token >>>>>>>>>>>>>>', token); }); }

On Wed, Jul 10, 2019 at 2:26 PM prashant214 notifications@github.com wrote:

This issue is resolved for me. I have used acquireToken() to get the new token . In acquireToken() I am passing my application client ID.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/manishrasrani/ms-adal-angular6/issues/23?email_source=notifications&email_token=AB3HWDPOT4X32LZQMWYDZFLP6WP3ZA5CNFSM4H4DEOCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZSZRQY#issuecomment-509974723, or mute the thread https://github.com/notifications/unsubscribe-auth/AB3HWDN6I7S5VEZRPTLTZDTP6WP3ZANCNFSM4H4DEOCA .