magiclabs / magic-flutter

Apache License 2.0
10 stars 5 forks source link

Flutter auth with Magic Link - Unhandled Exception code: -32603 , message: User denied account access #62

Closed sokolpaja closed 7 months ago

sokolpaja commented 7 months ago

Steps to reproduce create a flutter app configure the magic link auth

test: final info = await Magic.instance.user.getInfo(); final token = await Magic.instance.user.getIdToken(); print(token); print(info.email);

Expected results user is authed and can perform getIdToken

Actual results [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: {code: -32603, message: User denied account access.}

Code sample Code sample import 'package:magic_sdk/magic_sdk.dart';

Magic.instance = Magic("PUBLISHABLE_API_KEY");

// Assumes a user is already logged in try { var m = Magic.instance; const idToken = await m.user.getIdToken(); } catch { // Handle errors if required! } final info = await Magic.instance.user.getInfo(); final token = await Magic.instance.user.getIdToken(); print(token); print(info.email);

joshuascan commented 7 months ago

Hi @sokolpaja,

We are currently migrating our systems and there was a bug with how we were detecting mobile sessions in the new system. The fix was to properly detect how our key management system detected clients on mobile SDKs so we can hydrate sessions the proper way.

Please let us know if you continue to experience any issues!

sokolpaja commented 7 months ago

Hi @joshuascan thanks for reaching back. i tried the the method Magic.instance.user.getIdToken(); yesterday(11 apr), so now it works, a little heads up when some services are down it took me a lot of time to debug where the problem was(this may be from my little knowledge with working with flutter and magic link) but now its working thanks