Skip to main content
Question

What is the best practice for iOS SDK refresh token? 

  • May 22, 2025
  • 1 reply
  • 16 views

Forum|alt.badge.img

Authentication Method: User Authentication(OAuth 2.0)
SDK: iOS Box SDK
Version: 4.2.0
Custom Token info: Yes

 

Code:-

if let oAuthSession:OAuth2Session = self.client.session as? OAuth2Session { oAuthSession.refreshToken { result in switch result { case let .success(token): expect(token).to(equal("new access token")) case let .failure(error): fail("refreshToken should succeed, but instead got \(error)") } done() } }

After 24 hours, Refresh token is failing with 401 error code. What is the best practice for iOS SDK refresh token? 

Please guide me.

 

Thanks,

Prasad

1 reply

Forum|alt.badge.img

Hello Prasad, 

Could you please provide me with your API key (aka client ID) so I can take a look in our backend logs at the exact 401? 

Thanks, 

Kourtney

Box Developer Advocate