Skip to content
This repository was archived by the owner on Jun 25, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 1.0.0+2
# 1.0.0+2
* Updates to readme in regards to kotlin static field issues.
## 1.0.0+1
* Added some more information to readme for clarity
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ e.g. `https://msalfluttertest.b2clogin.com/tfp/msalfluttertest.onmicrosoft.com/B

For troubleshooting known bugs in the new build, please scroll down to the bottom of the page where all bugs and fixes we find will be noted.

# MSAL Wrapper Library for Flutter
## MSAL Wrapper Library for Flutter
Please note this product is in very early alpha release and subject to change and bugs.

The Microsoft Authentication Library Flutter Wrapper is a wrapper that uses that MSAL libraries for Android and IOS. Currently only the public client application functionality is supported, using the implicit workflow.
Expand Down Expand Up @@ -37,6 +37,7 @@ This section is mostly copied and modified from [the official android MSAL libra
```
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

```

2. In your AndroidManifest.xml file add the following intent filter, replacing the placeholder \<YOUR-CLIENT-ID\> for your azure b2c application's client id where indicated below.
Expand All @@ -53,6 +54,7 @@ The default redirect url is msal\<YOUR-CLIENT-ID\>://auth however this can now b
android:host="auth" />
</intent-filter>
</activity>

```

3. Copy the [msal_default_config](https://raw.githubusercontent.com/moodio/msal-flutter/master/doc/templates/msal_default_config.json) from this repository (or make your own if you know what you're doing) and place it into your flutter apps android/src/main/res/raw folder.
Expand Down Expand Up @@ -80,6 +82,7 @@ This section is mostly copied and modified from Step 1 from [the official iOS MS
</array>
</dict>
</array>

```

2. Add LSApplicationQueriesSchemes to allow making call to Microsoft Authenticator if installed (For Authentication broker)
Expand All @@ -90,6 +93,7 @@ This section is mostly copied and modified from Step 1 from [the official iOS MS
<string>msauthv2</string>
<string>msauthv3</string>
</array>

```

3. Open the app's iOS project in xcode, click on the Runner app to open up the configuration, and under capabilities, expand Keychain Sharing and add the keychain group `com.microsoft.adalcache`
Expand Down Expand Up @@ -143,6 +147,7 @@ try{
} on MsalException {
//error handling logic here
}

```

4. Once a user has logged in atleast once, to retrieve a token silently call the acquireTokenSilent function, passing the scopes you wish to acquire the token for. Note that this function will throw an error on failure and should be surrounded by a try catch block as per the example below
Expand Down Expand Up @@ -184,6 +189,9 @@ try{

# Trouble Shooting

Please note there is currently an issue that seems to occur with Android which uses slightly older versions of kotlin.
If you get the error when attemtping to acquire a token, along the lines of "static member msalApp not found", goto your app's android folder, open the build.gradle file, and on the second line change the version of kotlin from 1.3.10 to 1.3.50. For more information take a look at issue #4.
Please note there is currently an issue that seems to occur with Android which uses slightly older
versions of kotlin.
If you get the error when attemtping to acquire a token, along the lines of "static member msalApp
not found", goto your app's android folder, open the build.gradle file, and on the second line
change the version of kotlin from 1.3.10 to 1.3.50. For more information take a look at issue #4.
A fix will be implemented shortly.
13 changes: 10 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ rootProject.allprojects {
repositories {
google()
jcenter()
mavenCentral()
mavenLocal()
maven {
url 'https://pkgs.dev.azure.com/MicrosoftDeviceSDK/DuoSDK-Public/_packaging/Duo-SDK-Feed/maven/v1'
}
}
}

Expand All @@ -26,22 +31,24 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 28
compileSdkVersion 30

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
minSdkVersion 21
targetSdkVersion 30
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [msal_clientid: "5913dfb1-7576-451c-a7ea-a7c5a3f8682a"]
}
lintOptions {
disable 'InvalidPackage'
}

}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.microsoft.identity.client:msal:1.0.+'
implementation 'com.microsoft.identity.client:msal:2.0.2'
}
Loading