Open xzetic opened 2 years ago
Is there a way to implement that OAuth2Client.refreshToken returning as promise into Angular HttpInterceptor where it will auto refresh the token when we received an API status reply of 401. The framework is Angular. Thank you!
Run npx cap doctor:
npx cap doctor
Installed Dependencies: @capacitor/core: 3.4.3 @capacitor/cli: 3.4.3 @capacitor/android: 3.4.3 @capacitor/ios: 3.4.3
{ // Replace this with your plugin configuration }
Android
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.accenture.global.myte">
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:name="com.accenture.global.myte.MainActivity" android:label="@string/title_activity_main" android:theme="@style/AppTheme.NoActionBarLaunch" android:launchMode="singleTask"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="msauth://"/> </intent-filter> </activity> <provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"></meta-data> </provider>
-->
Info.plist
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>en</string> <key>CFBundleDisplayName</key> <string>MyTimeAndExpenses</string> <key>CFBundleExecutable</key> <string>$(EXECUTABLE_NAME)</string> <key>CFBundleIdentifier</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>$(PRODUCT_NAME)</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> <string>14.3.0</string> <key>CFBundleVersion</key> <string>3</string> <key>LSRequiresIPhoneOS</key> <true/> <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict> <key>UILaunchStoryboardName</key> <string>LaunchScreen</string> <key>UIMainStoryboardFile</key> <string>Main</string> <key>UIRequiredDeviceCapabilities</key> <array> <string>armv7</string> </array> <key>UISupportedInterfaceOrientations</key> <array> <string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeRight</string> </array> <key>UISupportedInterfaceOrientations~ipad</key> <array> <string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortraitUpsideDown</string> <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeRight</string> </array> <key>UIViewControllerBasedStatusBarAppearance</key> <true/> <key>NSCameraUsageDescription</key> <string>Privacy - Camera Usage Description</string> <key>NSPhotoLibraryAddUsageDescription</key> <string>Privacy - Photo Library Additions Usage Description</string> <key>NSPhotoLibraryUsageDescription</key> <string>Privacy - Photo Library Usage Description</string> <key>NSLocationAlwaysUsageDescription</key> <string>Privacy - Location Always Usage Description</string> <key>NSLocationWhenInUseUsageDescription</key> <string>Privacy - Location When In Use Usage Description</string> <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLSchemes</key> <array> <string>msauth.com.accenture.global.myte</string> </array> </dict> </array> </dict> </plist>
Description
Is there a way to implement that OAuth2Client.refreshToken returning as promise into Angular HttpInterceptor where it will auto refresh the token when we received an API status reply of 401. The framework is Angular. Thank you!
Capacitor version:
Run
npx cap doctor
:Installed Dependencies: @capacitor/core: 3.4.3 @capacitor/cli: 3.4.3 @capacitor/android: 3.4.3 @capacitor/ios: 3.4.3
Library version:
OAuth Provider:
Your Plugin Configuration
Affected Platform(s):
Android
AndroidManifest.xml
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme">
Info.plist