Here’s the complete solution based on your OAuth2 refresh token flow issues:
1. CORS Configuration for Mobile Clients:
Navigate to ICS Security Console > API Gateway > CORS Settings. Add your mobile app origin:
Allowed Origins: app://warehouse.infor.mobile
Allowed Methods: GET, POST, OPTIONS
Allowed Headers: Authorization, Content-Type
Expose Headers: X-Token-Expiry
For the OAuth2 refresh endpoint specifically, ensure it’s included in the CORS-enabled paths. Mobile apps don’t send traditional Origin headers, so you may need to configure the authorization server to accept requests with custom app schemes.
2. Token Expiration and Rotation Policies:
Your current 60-minute access token with 7-day refresh token is reasonable, but implement proactive refresh. Modify your mobile app’s token management:
// Refresh 10 minutes before expiry
if (tokenExpiresIn < 600) {
await refreshAccessToken();
}
Configure token rotation with overlap: In ICS Security Settings > OAuth2 Configuration, enable “Allow Refresh Token Reuse” with a 5-minute grace period. This prevents authentication gaps during the refresh process.
3. Mobile App Authentication Lifecycle:
Implement a proper token refresh interceptor in your mobile app that:
- Catches 401 Unauthorized responses
- Automatically calls the refresh token endpoint
- Retries the original request with the new access token
- Handles refresh token expiration by prompting re-authentication
The key issue is that your CORS policy isn’t allowing the preflight OPTIONS request from the mobile app. Once you add the mobile app origin and ensure the refresh endpoint is CORS-enabled, the token refresh flow should work seamlessly.
4. Verification Steps:
- Test the OPTIONS request to your refresh endpoint using curl or Postman with mobile app headers
- Monitor OAuth2 server logs during token refresh to see if requests are being blocked
- Implement logging in your mobile app to track token refresh attempts and failures
- Set up alerts for repeated token refresh failures to catch issues early
For warehouse operations, also consider implementing offline token caching with secure storage so pickers can continue working briefly during network interruptions. The mobile authentication lifecycle should handle network transitions gracefully without forcing re-login.
This configuration should eliminate the CORS errors and ensure smooth token rotation throughout picker shifts.
This draft is based on general Infor CloudSuite knowledge. It has not been verified against your specific version and environment. Practitioners: verify the steps and share your experience below.