0

I am trying to use AAD for login in my mobile app and it's working fine. But after some time like 1 hrs token expired, so I try to refresh, but I always got expired token in response,

If I logout and login then all working fine as per flow.

So not sure like where getting an issue....

I am using the https://pub.dev/packages/aad_oauth plugin for that as of now.

But for alternative I tried with https://pub.dev/packages/flutter_aad_oauth but into that, getting issue into the redirect URL so not spent more time figuring out.

Then after I found some good link for that https://www.hasaltaiar.com.au/how-to-best-handle-aad-access-tokens-in-native-mobile-apps/

but not sure how to use into Flutter without plugin

Has anyone here had experience with this or have any idea of how to get around this problem?

  • By default access token exp time has set as 60 min,Thats the reason you token get expire after 1 hr, You can use the refresh token,Refresh tokens are long-lived tokens used to acquire a new access token when the present access token gets invalid or expires. They enable the client to get a new access token without prompting the user – RahulKumarShaw Feb 26 '22 at 16:06
  • You can refer this Microsoft Link for more information:https://learn.microsoft.com/en-us/advertising/guides/authentication-oauth-get-tokens?view=bingads-13 – RahulKumarShaw Feb 26 '22 at 16:10
  • i know for access token expres 1 hour and refresh token expres 90 maximum 90 days. but how to generate refresh tokon flow in flutter app.i user two plugins but no any good results. so help – sumit_patel Feb 27 '22 at 06:32
  • Please refer this thread it may help you: https://stackoverflow.com/questions/67206941/flutter-how-to-refresh-token-when-token-expires-during-http-call – RahulKumarShaw Feb 27 '22 at 13:34
  • Think you for support, but its web solution and i need flutter project solution how to refresh token API call in post-man for your referral url i try but all time some error face I don't know but error_codes is 900144, 9002313 – sumit_patel Feb 28 '22 at 06:07
  • I call API, see this url image problem face https://prnt.sc/3h4xa-cvv2WV – sumit_patel Feb 28 '22 at 07:02
  • Make a POST request instead of GET – RahulKumarShaw Feb 28 '22 at 10:09
  • Please check this Link[https://learn.microsoft.com/en-us/advertising/guides/authentication-oauth-get-tokens?view=bingads-13#refresh-accesstoken] and use **Content-Type: application/x-www-form-urlencoded** – RahulKumarShaw Feb 28 '22 at 10:11
  • If api call time POST and GET method problme show error for 415 Unsupported Media Type. so it's not request problme. – sumit_patel Mar 01 '22 at 04:34
  • I passed in heder Content-Type: application/x-www-form-urlencoded see that image https://prnt.sc/D8eIrDfZxCNm and in body pass parameter in application/x-www-form-urlencoded https://prnt.sc/3h4xa-cvv2WV – sumit_patel Mar 01 '22 at 04:35

0 Answers0