@Daniel.Fischer i’m afraid that’s what you’ll need to stick with doing at this stage. Auth0 provides a logout endpoint so in theory it could be opened in a browser to trigger the logout and I tried this with url_launcher to see how it goes. Whilst it seemed to work fine on Android, a crash would occur within flutter_appauth
when processing the redirect even though the logout request was initiated outside the plugin
@sawing are you following everything in the blog post? Haven’t seen this error so it’s possible you’re missing something and should cross check with the code related to the article. You could try to run the code in GitHub against your tenant and application to check as well though should ensure that those have been setup correctly too
Thanks for sharing all that with the rest of community @MaikuB!
@MaikuB I tried with Auth0 account and every works fine in iOS as well.
This is an issue, JSON error parsing token response with GitHub · Issue #374 · openid/AppAuth-iOS · GitHub && Add Accept header to support GitHub by mrmuhammadali · Pull Request #375 · openid/AppAuth-iOS · GitHub, look like it’s similar to my problem. I have this issue with my own Oauth2 service.
If it works with Auth0 but not with your own OAuth2 service then I can’t help you there and the article is about using Auth0. Based on what you’ve said and the links you’ve provided, sounds like you’re possibly making use of a service that isn’t OAuth2 compliant, in which case you need to look into your own custom solution
Hi @sawing,
Are you having trouble with Auth0 or with the AppAuth library itself? Would you mind taking a moment to give us some more context? If Auth0 is working fine, I’m not sure there is an issue that our community will be much help with. I think more information will be helpful.
Good morning!
Any update on the follow up article on how to use the short format token? Maybe it’s there, but haven’t been able to find it.
Thanks!
How can you leverage Auth0 in a flutter web app?
Hey there Richard! Unfortunately right now this blogpost is the only content we offer for integrating with Auth0.
Don’t know what you’re referring to by short format token here as it’s not terminology I’ve seen before. The only reference I’ve seen is another post in this thread and the access token itself should be a JWT already
Thanks!
I just posted after reading the original blog post and this thread. Then I started analyzing and running the code and, as you say, found out the full JWT token is there ready to be used.
Thanks anyway for replying back
Glad you sorted it out!
We tried the arch18 method and that didn’t seem to work. With audience defined we’re still getting a short token. What was your solution regis_mazur?
Hello. Is it possible to use http instead of https ?
I had this error also if I commented promptValues: ['login']
:
I/flutter (18477): login error: PlatformException(authorize_and_exchange_code_failed, Failed to authorize: [error: null, description: User cancelled flow], null, null) - stack: #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:582:7)
I/flutter (18477): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:159:18)
I/flutter (18477): <asynchronous suspension>
I/flutter (18477): #2 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:332:12)
I/flutter (18477): #3 MethodChannelFlutterAppAuth.authorizeAndExchangeCode (package:flutter_appauth_platform_interface/src/method_channel_flutter_appauth.dart:32:57)
I/flutter (18477): #4 FlutterAppAuth.authorizeAndExchangeCode (package:flutter_appauth/src/flutter_appauth.dart:7:44)
I/flutter (18477): #5 _MyAppState.loginAction (package:flutterdemo/main.dart:169:21)
I/flutter (18477): #6 Login.build.<anonymous closure> (package:flutterdemo/main.dart:86:30)
I/flutter (18477): #7 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:993:19)
I/flutter (18477): #8 _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:1111:38)
I/flutter (18477): #9 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:183:24)
I/flutter (18477): #10 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:598:11)
I/flutter (18477): #11 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:287:5)
I/flutter (18477): #12 BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:222:7)
I/flutter (18477): #13 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:476:9)
I/flutter (18477): #14 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:77:12)
I/flutter (18477): #15 PointerRouter._dispatchEventToRoutes.<anonymous closure> (package:flutter/src/gestures/pointer_router.dart:122:9)
I/flutter (18477): #16 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:377:8)
I/flutter (18477): #17 PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:120:18)
I/flutter (18477): #18 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:106:7)
I/flutter (18477): #19 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:358:19)
I/flutter (18477): #20 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:338:22)
I/flutter (18477): #21 RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:267:11)
I/flutter (18477): #22 GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:295:7)
I/flutter (18477): #23 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:240:7)
I/flutter (18477): #24 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:213:7)
I/flutter (18477): #25 _rootRunUnary (dart:async/zone.dart:1206:13)
I/flutter (18477): #26 _CustomZone.runUnary (dart:async/zone.dart:1100:19)
I/flutter (18477): #27 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)
I/flutter (18477): #28 _invoke1 (dart:ui/hooks.dart:265:10)
I/flutter (18477): #29 _dispatchPointerDataPacket (dart:ui/hooks.dart:174:5)
I/flutter (18477):
D/skia (18477): Shader compilation error
D/skia (18477): ------------------------
D/skia (18477): Errors:
D/skia (18477):
I/flutter (18477): login error: PlatformException(authorize_and_exchange_code_failed, Failed to authorize: [error: null, description: User cancelled flow], null, null) - stack: #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:582:7)
I/flutter (18477): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:159:18)
I/flutter (18477): <asynchronous suspension>
I/flutter (18477): #2 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:332:12)
I/flutter (18477): #3 MethodChannelFlutterAppAuth.authorizeAndExchangeCode (package:flutter_appauth_platform_interface/src/method_channel_flutter_appauth.dart:32:57)
I/flutter (18477): #4 FlutterAppAuth.authorizeAndExchangeCode (package:flutter_appauth/src/flutter_appauth.dart:7:44)
I/flutter (18477): #5 _MyAppState.loginAction (package:flutterdemo/main.dart:169:21)
I/flutter (18477): #6 Login.build.<anonymous closure> (package:flutterdemo/main.dart:86:30)
I/flutter (18477): #7 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:993:19)
I/flutter (18477): #8 _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:1111:38)
I/flutter (18477): #9 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:183:24)
I/flutter (18477): #10 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:598:11)
I/flutter (18477): #11 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:287:5)
I/flutter (18477): #12 BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:222:7)
I/flutter (18477): #13 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:476:9)
I/flutter (18477): #14 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:77:12)
I/flutter (18477): #15 PointerRouter._dispatchEventToRoutes.<anonymous closure> (package:flutter/src/gestures/pointer_router.dart:122:9)
I/flutter (18477): #16 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:377:8)
I/flutter (18477): #17 PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:120:18)
I/flutter (18477): #18 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:106:7)
I/flutter (18477): #19 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:358:19)
I/flutter (18477): #20 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:338:22)
I/flutter (18477): #21 RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:267:11)
I/flutter (18477): #22 GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:295:7)
I/flutter (18477): #23 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:240:7)
I/flutter (18477): #24 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:213:7)
I/flutter (18477): #25 _rootRunUnary (dart:async/zone.dart:1206:13)
I/flutter (18477): #26 _CustomZone.runUnary (dart:async/zone.dart:1100:19)
I/flutter (18477): #27 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)
I/flutter (18477): #28 _invoke1 (dart:ui/hooks.dart:265:10)
I/flutter (18477): #29 _dispatchPointerDataPacket (dart:ui/hooks.dart:174:5)
I/flutter (18477):
Uncommenting promptValues: ['login']
solves the issue for me.
Thanks for sharing that with the rest of community!
Hello again! I would like to know if it’s possible to use client secret in AuthorizationTokenRequest()
.
await appAuth.authorizeAndExchangeCode(
AuthorizationTokenRequest(
AUTH0_CLIENT_ID,
AUTH0_REDIRECT_URI,
clientSecret: CLIENT_SECRET,
issuer: AUTH0_ISSUER,
scopes: <String>['openid', 'profile'],
promptValues: ['login']
),
);
The error I’m having is:
authorize_and_exchange_code_failed, Failed to authorize: [error: invalid_client, description: null]
Yes it is. If you’re having issues then I would suggest to double check the values you’re sending and how you configured the application in Auth0. I tried passing in the client secret to the native app I had registered in Auth0 and didn’t see any errors
Thanks for sharing that @MaikuB !
As with benvalenti, I am unable to get the audience to show up in the JWT sent to the server using the code indicated. I only get the “short code” mentioned.
AuthorizationTokenRequest(
AUTH0_CLIENT_ID,
AUTH0_REDIRECT_URI,
issuer: AUTH0_ISSUER,
additionalParameters: {'audience': AUTH0_AUDIENCE},
scopes: ['openid', 'email', 'profile', 'offline_access', 'api'],
discoveryUrl: '$AUTH0_ISSUER/.well-known/openid-configuration',
),
AUTH0_AUDIENCE = 'https://resource.api"
With examples like this, it is not always obvious what the required bits are to make it work.
Is the scope ‘api’ required? How about the discoveryUrl? If so, is the openid-configuration something I need to create, or does it already exist?
Should ‘audience’ be ‘aud’?
while running the code I faced this error and it stuck in the page that contains login button and showing the exception under that button in the same page without moving to the form to enter the user information and I don’t know how to fix it
login error: PlatformException(authorize_and_exchange_code_failed, Failed to authorize: access_denied: Unauthorized, null, null) - stack: #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:581:7)
#1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:158:18)
#2 MethodChannelFlutterAppAuth.authorizeAndExchangeCode (package:flutter_appauth_platform_interface/src/method_channel_flutter_appauth.dart:32:42)
#3 _MyAppState.loginAction (package:flutterdemo/main.dart:158:7)