Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No access_token detected (orj. example) #274

Closed
yutech23 opened this issue Nov 12, 2022 · 19 comments · Fixed by #284
Closed

No access_token detected (orj. example) #274

yutech23 opened this issue Nov 12, 2022 · 19 comments · Fixed by #284
Labels
bug Something isn't working

Comments

@yutech23
Copy link

yutech23 commented Nov 12, 2022

I USE autH.signInWithPassword()

I upgraded 1.1.0 version. I got a error. it's "No access_token detected.
I have tried example in git but I got same error.
Please Help can

image

@yutech23 yutech23 added the bug Something isn't working label Nov 12, 2022
@dshukertjr
Copy link
Member

@yutech23 Could you follow the issue format and provide steps to reproduce?

@d-e-h-i-o
Copy link

@dshukertjr I'm getting the same error as well. To reproduce just use the official example, bump supabase_flutter to ^1.0.1 and open the app in a webbrowser.

It would be great if you could investigate that bug.

@d-e-h-i-o
Copy link

d-e-h-i-o commented Nov 15, 2022

Some more info: In my own codebase, I also get the error in version 1.0.0. It basically follows the tutorial from the supabase website. When I go to my splash page http://localhost:63771/#SplashPage it works flawless, however, everytime I reload from a different screen, e.g. http://localhost:63771/#LearningTab the error occurs.

***** SupabaseDeepLinkingMixin startAuthObserver ***** SupabaseAuthState handleDeeplink http://localhost:63771/#LearningTab onReceivedAuthDeeplink uri: http://localhost:63771/#LearningTab No access_token detected.
I hope that helps.

@d-e-h-i-o
Copy link

@yutech23 Configuring URL strategy to usePathUrlStrategy() helped me, if you are looking for a quick fix.

@dshukertjr
Copy link
Member

@d-e-h-i-o
I just tried the example app you mentioned, and was able to sign in without any issue.
https://www.loom.com/share/913ceb26e8294ab3a1a80330b518a6b6

however, every time I reload from a different screen, e.g. http://localhost:63771/#LearningTab the error occurs.

What is the use case here? This example app is configured so that the user has to go through SplashPage in order to be redirected to the appropriate page.

@yutech23
Copy link
Author

@yutech23 Configuring URL strategy to usePathUrlStrategy() helped me, if you are looking for a quick fix.

it doesn't work. :(

@dshukertjr
Copy link
Member

dshukertjr commented Nov 19, 2022

@yutech23
What happens after you click the confirmation link on your email? Does it not open the account page like in the video here?

@yutech23
Copy link
Author

@yutech23 What happens after you click the confirmation link on your email? Does it not open the account page like in the video here?

I don't use email's confirmation. I use signInWithPassword() func. It gives an error right after running the application.

Database Connection Code****
//Giriş Ekran Sorgulama
Future<Map<String, String?>> singIn(
BuildContext context, String setEmail, String setPassword) async {
Map<String, String?> userSessionMap = {};
bool status = false;

try {
  final res = await db.supabase.auth
      .signInWithPassword(email: setEmail, password: setPassword);
  status = true;
  userSessionMap.addAll({
    'id': res.user?.id,
    'token': res.session?.accessToken,
    'refreshToken': res.session?.refreshToken,
    'status': status.toString()
  });
  context.extenionShowSnackBar(message: 'Giriş başarılı.');
  return userSessionMap;
} on AuthException catch (error) {
  context.extensionShowErrorSnackBar(message: error.message);
  return userSessionMap;
}

}

****************** Login Screen Code (Button Action)********************
//Kayıt Buttonu
DecoratedBox widgetButtonSaveOn(BuildContext context) {
return DecoratedBox(
decoration: context.extensionThemaButton(),
child: ElevatedButton(
focusNode: _loginButtonFocus,
style: ElevatedButton.styleFrom(
backgroundColor: Colors.transparent,
disabledBackgroundColor: Colors.transparent,
shadowColor: Colors.transparent,
),
onPressed: () {
Kullanici loginKullanici = Kullanici.session();
db
.singIn(context, _controllerEmail.text, _controllerSifre.text)
.then((value) {
if (value['status'] == 'true') {
loginKullanici.id = value['id']!;
loginKullanici.token = value['token'];
loginKullanici.refreshToken = value['refreshToken'];

            } else {
              _controllerSifre.clear();
            }
          });
        },

Main**
Future main() async {
usePathUrlStrategy();
DbHelper.dbBaslat();
runApp(const MyApp());
}

@TommyLCox
Copy link
Contributor

@yutech23 Could you follow the issue format and provide steps to reproduce?

I was trying to setup a basic app to demonstrate this error that I am also seeing. I could not even accomplish that due to to another similar error in the basic web demo project (error is under flutter web only) that I posted here - #282 . If I can get #282 resolved, I will continue to work to setup a basic project to confirm the error that @yutech23 is having.

@dshukertjr
Copy link
Member

@yutech23
I think I finally understand what the issue is here. No access_token detected is an error message from the deep link handler, that is just saying there were no access token in the current URL when you launch an app, which is expected. I think we can better handle the case, and not make it seem like there is something wrong with the code, but this should not have any effects on your app's functionalities.

@yutech23
Copy link
Author

@yutech23 I think I finally understand what the issue is here. No access_token detected is an error message from the deep link handler, that is just saying there were no access token in the current URL when you launch an app, which is expected. I think we can better handle the case, and not make it seem like there is something wrong with the code, but this should not have any effects on your app's functionalities.

i had guessed. :) Do we have the solution ? :) Because;
when running (F5 key) application with vscode, Application stops. But when running application with terminal, Application continues. just showing error in terminal screen. so I can't update new version

@TommyLCox
Copy link
Contributor

TommyLCox commented Nov 21, 2022

@yutech23 - In the VS Code Breakpoints section, when I unchecked the box "Uncaught Exceptions", it quit causing the program to stop on this exception.

@TommyLCox
Copy link
Contributor

TommyLCox commented Nov 21, 2022

@yutech23 I think I finally understand what the issue is here. No access_token detected is an error message from the deep link handler, that is just saying there were no access token in the current URL when you launch an app, which is expected. I think we can better handle the case, and not make it seem like there is something wrong with the code, but this should not have any effects on your app's functionalities.

@dshukertjr - Yes, I was coming on here to let you know that it was in the deep link handler:
***** Supabase init completed Instance of 'Supabase' Got object store box in database supabase_authentication. ***** SupabaseDeepLinkingMixin startAuthObserver ***** SupabaseAuthState handleDeeplink http://localhost:49855/#/ onReceivedAuthDeeplink uri: http://localhost:49855/#/ No access_token detected.

I agree that it "should not" cause downstream effects on an app's functionality, but it is confusing because it produces a lot of messages that say "Error" and outputs an error stack trace that makes it appear worse than what it is. Also, it is an Unhandled Exception and there is no real way to catch it.

Suggestion: Just make it an informational message "No access token found" and don't throw an unhandled exception all the way out to the application.

This error message essentially made tough to find another real error I was having at startup that has now been resolved. And, as long as my VS Code doesn't have the box in Breakpoints set to break on Unhandled Exceptions, I can proceed fine as is until the handling of this is improved. Hopefully, that will help @yutech23 for now.

@dshukertjr
Copy link
Member

@yutech23
You can also just press the play button on your vs code debug controller.
Screen Shot 2022-11-22 at 16 57 29

@dshukertjr
Copy link
Member

@TommyLCox
Yup, agree that this error is confusing. I was taking a look at the code, and the cause is that parsing the URL is occurring for every URL of the page, where as it should only be parsed if there are certain query parameters present, like accessToken. Will try to ship a fix for this one soon!

@yutech23
Copy link
Author

yutech23 commented Nov 22, 2022

@yutech23 You can also just press the play button on your vs code debug controller. Screen Shot 2022-11-22 at 16 57 29
You may need to press constantly.
Thank you for all reply. I am waiting new update.

@d-e-h-i-o
Copy link

@d-e-h-i-o I just tried the example app you mentioned, and was able to sign in without any issue. https://www.loom.com/share/913ceb26e8294ab3a1a80330b518a6b6

however, every time I reload from a different screen, e.g. http://localhost:63771/#LearningTab the error occurs.

What is the use case here? This example app is configured so that the user has to go through SplashPage in order to be redirected to the appropriate page.

@dshukertjr I'm sorry, I should have specified that you need to look at the console to see the error message at the example app. For my app, there was no specific use case (except that people do refresh a browser sometimes, and staying at a route would maybe be a better user experience).

Thank you very much for looking into it!

@dshukertjr
Copy link
Member

Sorry for the delay, but this issue should now be fixed with v1.2.1 of supabase-flutter!

@yutech23
Copy link
Author

Sorry for the delay, but this issue should now be fixed with v1.2.1 of supabase-flutter!

Thank you @dshukertjr :) i will try right away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants