nodriver-ai / flutter_azure_b2c

A flutter library to handle the Azure B2C authentication protocol.
MIT License
7 stars 19 forks source link

Initial attempt to get access token results in a null reference exception. #8

Closed JudeAlquiza closed 2 years ago

JudeAlquiza commented 2 years ago

Hi,

I'm noticing this behavior in the sample code (https://pub.dev/packages/flutter_azure_b2c/example) in both 0.0.8 and 0.0.9 versions for android, after log in, the very first attempt to get the access token results in a null reference exception, but after I click User Info then hit Refresh, then hit Access Token, then I'm able to successfully get an access token, just want to get your thoughts on this behavior.

Thanks!

chipscal commented 2 years ago

Hi,

Yes, it is a normal behavior, the reason is that in order to get the access token you need to pass a subject (string) to specify for which user get one. The sample code is a bit naive and get and store this string in a variable after the user info button is clicked. In your app you can implement this procedure for example in the policytriggerinteractive callback.

JudeAlquiza commented 2 years ago

Hi,

Thanks, this make sense now.