MaikuB / flutter_appauth

A Flutter wrapper for AppAuth iOS and Android SDKs
269 stars 238 forks source link

HTTP ERROR 500, returnUrl null, redict failed. #462

Closed TuonggVi closed 6 months ago

TuonggVi commented 7 months ago

The situation is that on the same server, when accessing the login endpoint via the desktop app, it is possible to receive the token, while the mobile app encounters a 500 error due to a null returnUrl, leading to a failed redirect. final AuthorizationTokenResponse? result = await _appAuth.authorizeAndExchangeCode( AuthorizationTokenRequest( clientId, redirectUri, serviceConfiguration: AuthorizationServiceConfiguration( tokenEndpoint: 'https://authenticationserver2023.azurewebsites.net/connect/token', authorizationEndpoint: 'https://authenticationserver2023.azurewebsites.net/connect/authorize' ), scopes: scopes, issuer: 'https://authenticationserver2023.azurewebsites.net', ), ); Config mobile app:

manifestPlaceholders += [ 'appAuthRedirectScheme': 'native-client'

  <intent-filter android:autoVerify="true">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <!-- Accepts URIs that begin with https://YOUR_HOST -->
    <data
      android:scheme="native-client"
      android:host="authenticationserver2023.azurewebsites.net" />
  </intent-filter>

Do I need to use a query in my code or not? Please help me

MaikuB commented 6 months ago

An issue like this is something you would have to investigate on your end as it's all configuration-specific and specific to your situation. It wouldn't a plugin issue so you need to ensure you understand how OAuth works (includes understanding redirect URLs) and how your identity provider/auth server works in case it's not compliant with how OAuth is implemented and requires extra details.

Closing as it's not something you have to look into further