Authorization canceled error.
oksuzozkan opened this issue · comments
Hi,
i am trying to get access tokens from microsoft via appauth but i always get Authorization canceled error.
use the example app from appAuth-Android and just changed the auth_config.json parameter.
The app open the webbrowers with this "https://businesscentral.dynamics.com/OAuthLanding.htm" link and close automaticly. onActivityResult resultCode always = RESULT_CANCELED
after clear chrome browsingdata: Not authorized error "Authorization Code exchange failed invalid_client".
i found something strange here:
TokenActivitiy is opened after the web browser closes. There the exchangeAuthorizationCode function is called with the following parameters: authorizationResponse and do performTokenRequest the authorizationCode ist not null also can send Tokenrequest. Why not change the authstate? authorizationCode != null mean Authorization successfully or after get accesstoken is the state "isAuthorized= true"?
auth_config.json file
"client_id": "myid",
"redirect_uri": "https://businesscentral.dynamics.com/OAuthLanding.htm",
"end_session_redirect_uri": "https://businesscentral.dynamics.com/OAuthLanding.htm",
"authorization_scope": "https://api.businesscentral.dynamics.com/.default offline_access",
"discovery_uri": "https://login.microsoftonline.com/mytenant/v2.0/.well-known/openid-configuration",
"authorization_endpoint_uri": "https://login.microsoftonline.com/mytenant/oauth2/v2.0/authorize",
"token_endpoint_uri": "https://login.microsoftonline.com/mytenant/oauth2/v2.0/token",
"registration_endpoint_uri": "",
"user_info_endpoint_uri": "https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration",
"https_required": true
Manifest file
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<activity
android:name="net.openid.appauth.RedirectUriReceiverActivity"
tools:node="replace">
<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="https"
android:host="businesscentral.dynamics.com"
android:path="/OAuthLanding.htm"/>
</intent-filter>
</activity>
</application>
Logcat
HostConnection::get() New Host Connection established 0xdd72a230, tid 11311
2024-01-04 12:45:11.136 11281-11311 HostConnection com.xxx.httpconnection D HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1 ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache ANDROID_EMU_sync_buffer_data GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_2
2024-01-04 12:45:11.137 11281-11311 ConfigStore com.xxx.httpconnection I android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
2024-01-04 12:45:11.137 11281-11311 ConfigStore com.xxx.httpconnection I android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
2024-01-04 12:45:11.137 11281-11311 OpenGLRenderer com.xxx.httpconnection I Initialized EGL, version 1.4
2024-01-04 12:45:11.137 11281-11311 OpenGLRenderer com.xxx.httpconnection D Swap behavior 1
2024-01-04 12:45:11.137 11281-11311 OpenGLRenderer com.xxx.httpconnection W Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
2024-01-04 12:45:11.137 11281-11311 OpenGLRenderer com.xxx.httpconnection D Swap behavior 0
2024-01-04 12:45:11.148 11281-11311 eglCodecCommon com.xxx.httpconnection D setVertexArrayObject: set vao to 0 (0) 0 0
2024-01-04 12:45:11.148 11281-11311 EGL_emulation com.xxx.httpconnection D eglCreateContext: 0xdd7053c0: maj 2 min 0 rcv 2
2024-01-04 12:45:11.152 11281-11311 EGL_emulation com.xxx.httpconnection D eglMakeCurrent: 0xdd7053c0: ver 2 0 (tinfo 0xdd703750)
2024-01-04 12:45:11.162 11281-11311 EGL_emulation com.xxx.httpconnection D eglMakeCurrent: 0xdd7053c0: ver 2 0 (tinfo 0xdd703750)
2024-01-04 12:45:16.754 11281-11281 ActivityThread com.xxx.httpconnection W handleWindowVisibility: no activity for token android.os.BinderProxy@3f1a52e