Getting error when trying to update version
https://search.maven.org/artifact/com.amazonaws/aws-android-sdk-auth-userpools
val initializeBuilder = AWSMobileClient.getInstance().initialize(activity) {
createAwsSessionComponent(environment, configuration)
doAfter.run()
}
initializeBuilder.awsConfiguration(configuration)
initializeBuilder.execute()
getting error
Type mismatch.
Required:
Callback<UserStateDetails!>!
Found:
() → Unit
I am currently getting this error while logging analytics was able to log all other events but a specific event when popup box is display i am getting this issue.
AbstractKinesisRecorder: DeadLetterListener onRecordsDropped has thrown an exception (user code)
java.lang.NullPointerException: Attempt to invoke interface method 'void com.amazonaws.mobileconnectors.kinesis.kinesisrecorder.DeadLetterListener.onRecordsDropped(java.lang.String, java.util.List)' on a null object reference
AbstractKinesisRecorder: ServiceException in submit all, the last request is presumed to be the cause and will be dropped
com.amazonaws.AmazonServiceException: User:
To create a Native Android Mobile app that can invoke AWS Services, try using the AWS SDK for Kotlin. You can find information on how to get up and running with this SDK here:
Setting up the AWS SDK for Kotlin
This SDK works nicely with Android Studio to build Android Apps. It exposes a strongly typed Service Client you can use within an Android Studio project. For example, to invoke SNS, you can use SnsClient:
fun getClient() : SnsClient{
val staticCredentials = StaticCredentialsProvider {
accessKeyId = "<Enter key>"
secretAccessKey = "<Enter key>"
}
val snsClient = SnsClient{
region = "us-west-2"
credentialsProvider = staticCredentials
}
return snsClient
}
Link in the comment below.
Related
MSALs java methods of ISingleAccountPublicClientApplication
signIn(activity, loginHint, scopes, authenticationCallback) and acquireTokenSilent(scopes, authority) is deprecated, in favour of build methods.
So I changed the signIn to use SignInParameters.builder() like this:
(below in kotlin)
From:
...signIn(
signInActivity,
null, //loginHint
arrayOf(accessScope),
object : AuthenticationCallback { /*omitted*/ },
)
To:
...signIn(
SignInParameters.builder(
.withActivity(signInActivity),
.withScopes(arrayOf(accessScope).toMutableList())
.withCallback(
object : AuthenticationCallback { /*omitted*/
})
.build()
)
So far, the sign in process seems to go well, no errors, but the problems occures when I call the new acquireTokenSilent method with AcquireTokenSilentParameters used.
From:
val iAuthenticationResult = singleAccountApp.acquireTokenSilent(
arrayOf(accessScope),
MICROSOFT_ACCESS_AUTHORITY
)
To:
val iAuthenticationResult = singleAccountApp.acquireTokenSilent(
AcquireTokenSilentParameters(
AcquireTokenSilentParameters.Builder()
.withScopes(arrayOf(accessScope).toMutableList())
.fromAuthority(MICROSOFT_ACCESS_AUTHORITY)
)
)
Now I get following error message in response when acquiring token:
The signed in account does not match the provided account which further causes 401 Unauthorized response.
Rewinding back to use the old method just for acquireTokenSilent does not produce any error and the token is provided.
Now I am stuck in new for signIn method, but an old one for the acquireTokenSilent method.
Is there anything I have skipped or forgotten using the newer one ?
I am using the Jitsi Flutter plugin in conjunction with 8x8's Jitsi-as-a-Service offering to integrate video calls into my mobile app.
Immediately after joining a meeting, the call ends and Jitsi closes. The logs indicate that the underlying Jitsi Meet SDK is unable to fetch config.js from 8x8:
E/JitsiMeetSDK(10937): [features/base/lib-jitsi-meet] Failed to load config from https://8x8.vc/vpaas-magic-cookie-<tenantID>/hello-world/config.js?room=vpaas-magic-cookie-<tenantID>hello-world Error(Error){"message":"loadScript error: undefined","stack":"index.android.bundle:538:817\np#index.android.bundle:284:423\nindex.android.bundle:284:1740\np#index.android.bundle:284:423\nn#index.android.bundle:284:898\nindex.android.bundle:284:1047\nf#index.android.bundle:111:155\nindex.android.bundle:111:882\ny#index.android.bundle:117:661\nC#index.android.bundle:117:1025\ncallImmediates#index.android.bundle:117:3100\ncallImmediates#[native code]\nvalue#index.android.bundle:36:3247\nindex.android.bundle:36:1283\nvalue#index.android.bundle:36:2939\nvalue#index.android.bundle:36:1253\nvalue#[native code]\nvalue#[native code]"}
I/JitsiMeetSDK(10937): [features/overlay] The conference will be reloaded after 19 seconds.
D/JitsiMeetSDK(10937): ExternalAPI Sending event: CONFERENCE_TERMINATED with data: { NativeMap: {"url":"https://8x8.vc/vpaas-magic-cookie-<tenantID>/hello-world/vpaas-magic-cookie-<tenantID>hello-world","error":"Error: loadScript error: undefined"} }
E/ThemeUtils(10937): View class com.facebook.react.views.text.ReactTextView is an AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant).
I/chatty (10937): uid=10179(com.example.app) identical 1 line
E/ThemeUtils(10937): View class com.facebook.react.views.text.ReactTextView is an AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant).
D/JITSI_MEET_PLUGIN(10937): JitsiMeetPluginActivity.onConferenceTerminated: {error=Error: loadScript error: undefined, url=https://8x8.vc/vpaas-magic-cookie-<tenantID>/hello-world/vpaas-magic-cookie-<tenantID>hello-world}
D/JITSI_MEET_PLUGIN(10937): JitsiMeetEventStreamHandler.onConferenceTerminated
I/JitsiMeetSDK(10937): Conference terminated: {error=Error: loadScript error: undefined, event=onConferenceTerminated, url=https://8x8.vc/vpaas-magic-cookie-<tenantID>/hello-world/vpaas-magic-cookie-<tenantID>hello-world}
I/JitsiMeetSDK(10937): [features/base/connection] No connection found while disconnecting.
I followed the official 8x8 JaaS docs on how to configure Jitsi in my app:
_joinMeeting(String token, String userName) async {
FeatureFlag featureFlag = FeatureFlag();
featureFlag.welcomePageEnabled = false;
// ...
featureFlag.resolution = FeatureFlagVideoResolution.HD_RESOLUTION;
var options = JitsiMeetingOptions()
..serverURL = "https://8x8.vc"
..room = "vpaas-magic-cookie-<tenantID>/hello-world"
..subject = "Hello World"
..token = token
..userDisplayName = userName
..audioOnly = false
..audioMuted = true
..videoMuted = true
..featureFlag = featureFlag;
await JitsiMeet.joinMeeting(options, roomNameConstraints: Map());
}
It works flawlessly with the public meet.jit.si servers but does not with 8x8's JaaS offering. What am I missing?
Using 8x8's JaaS offering with the Jitsi Flutter plugin
TL;DR: Set the full URL of your 8x8 meeting as the room name.
If you follow the official 8x8 Jaas docs, you will likely end up with Jitsi Flutter being unable to load config.js from the 8x8 server.
This forum comment hints that one can join 8x8 meetings via the official Jitsi Meet app from the App Store by using the full 8x8 meeting URL as the room name.
As a matter of fact, this not only works for the official app, but also for the Jitsi Flutter plugin. Using the configuration below you should be able to connect to a meeting room on your 8x8 tenant. Please make sure to disable any room name constraints by passing an empty map to joinMeeting, otherwise Jitsi Flutter will reject your room name!
_joinMeeting(String token, String userName) async {
FeatureFlag featureFlag = FeatureFlag();
featureFlag.welcomePageEnabled = false;
// ...
featureFlag.resolution = FeatureFlagVideoResolution.HD_RESOLUTION;
var options = JitsiMeetingOptions()
..serverURL = "https://8x8.vc"
..room = "https://8x8.vc/vpaas-magic-cookie-<tenantID>/<roomName>"
..subject = "Hello World"
..token = token
..userDisplayName = userName
..audioOnly = false
..audioMuted = true
..videoMuted = true
..featureFlag = featureFlag;
await JitsiMeet.joinMeeting(options, roomNameConstraints: Map());
}
Hope this saves you some time.
I have this Firebase Cloud Function:
exports.verifyToken = functions.https.onRequest(async (req, res) => {
const token = req.query.token;
console.log("token: " + token);
return firebaseAdmin
.auth()
.createCustomToken(token, {provider: 'TEST'})
.then((firebaseToken) => {
console.log("Returning firebase token to user: " + firebaseToken);
return res.json({firebase_token: firebaseToken});
});
});
And this is my android code:
return Single.create<String> { emitter ->
val token = authToken.accessToken
val data = HashMap<String, String>()
data.put("token", token)
FirebaseFunctions.getInstance()
.getHttpsCallable("verifyToken")
.call(data)
.continueWith { task ->
return#continueWith task.result?.data as String
}
.addOnSuccessListener { firebaseToken ->
emitter.onSuccess(firebaseToken)
}
.addOnFailureListener {
emitter.onError(it)
}
}
When I try to run the cloud function via firebase emulator and Postman, it works fine. The function was able to get the value of token. But whenever I do it via Android, I get this from the Firebase Functions Logs:
4:29:40.837 AM
verifyToken
Function execution started
4:29:41.411 AM
verifyToken
token: undefined //<--- this here says that the token is undefined.
4:29:41.554 AM
verifyToken
Unhandled rejection
4:29:41.560 AM
verifyToken
Error: `uid` argument must be a non-empty string uid. at FirebaseAuthError.FirebaseError [as constructor] (/workspace/node_modules/firebase-admin/lib/utils/error.js:43:28) at FirebaseAuthError.PrefixedFirebaseError [as constructor] (/workspace/node_modules/firebase-admin/lib/utils/error.js:89:28) at new FirebaseAuthError (/workspace/node_modules/firebase-admin/lib/utils/error.js:148:16) at FirebaseTokenGenerator.createCustomToken (/workspace/node_modules/firebase-admin/lib/auth/token-generator.js:233:19) at Auth.BaseAuth.createCustomToken (/workspace/node_modules/firebase-admin/lib/auth/auth.js:96:36) at /workspace/index.js:25:6 at cloudFunction (/workspace/node_modules/firebase-functions/lib/providers/https.js:51:16) at /layers/google.nodejs.functions-framework/functions-framework/node_modules/#google-cloud/functions-framework/build/src/invoker.js:100:17 at processTicksAndRejections (internal/process/task_queues.js:79:11)
4:29:41.562 AM
verifyToken
Function execution took 725 ms, finished with status: 'crash'
If you have noticed, the code is almost similar to what Firebase has in their getting started pages. But then it doesn't fully work on my end.
I have already checked with my google-services.json and it's already updated.
I am currently set as the owner of the project, so no issues with firebase deploy
I also have the service-account.json updated and included with the firebase functions.
I might have missed something in my code or configuration. Any inputs are greatly appreciated!
It's not possible to use the Firebase Functions SDK to invoke onRequest type functions. The Firebase SDK implements the client side of a callable function that you declare with onCall. You're using onRequest here, which means you're writing a standard HTTP type function. For that type of function, you should use a standard HTTP client (not the Firebase SDK). If you actually did want to use the Firebase SDK to invoke your function, you will have to write a callable function instead. Note that callable functions have their own spec, and you won't be able to easily invoke them from postman.
I'm trying to run the code that I copy-pasted from here, specifically this line
val region = Region.AP_SOUTHEAST_1
val s3 = S3Client.builder().region(region).build()
but everytime I run it, it will give me this error
java.lang.VerifyError: Verifier rejected class
software.amazon.awssdk.http.apache.ApacheHttpClient: void
software.amazon.awssdk.http.apache.ApacheHttpClient.lambda$LRMaF_8eLuzzpRjS-Ew4gJswCBw(org.apache.http.client.methods.HttpRequestBase) failed to verify: void
software.amazon.awssdk.http.apache.ApacheHttpClient.lambda$LRMaF_8eLuzzpRjS-Ew4gJswCBw(org.apache.http.client.methods.HttpRequestBase):
[0x0] 'this' argument 'Reference:
org.apache.http.client.methods.HttpRequestBase' not instance of
'Reference:
org.apache.http.client.methods.AbstractExecutionAwareRequest'
(declaration of 'software.amazon.awssdk.http.apache.ApacheHttpClient'
appears in
/data/app/com.imincode.earthlings-Jxs426ZYpcjwZtg1zzKjkw==/base.apk!classes3.dex)
at software.amazon.awssdk.http.apache.ApacheHttpClient.builder(ApacheHttpClient.java:133)
at software.amazon.awssdk.http.apache.ApacheSdkHttpService.createHttpClientBuilder(ApacheSdkHttpService.java:29)
at software.amazon.awssdk.core.internal.http.loader.-$$Lambda$-cEpDqlhpsSVBRGa6lPjzgTy1tM.apply(Unknown
Source:2)
at java.util.Optional.map(Optional.java:211)
at software.amazon.awssdk.core.internal.http.loader.DefaultSdkHttpClientBuilder.buildWithDefaults(DefaultSdkHttpClientBuilder.java:41)
at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.lambda$resolveSyncHttpClient$5$SdkDefaultClientBuilder(SdkDefaultClientBuilder.java:274)
at software.amazon.awssdk.core.client.builder.-$$Lambda$SdkDefaultClientBuilder$mSpkyGAugx5W7tgD88eQuJnqvEs.get(Unknown
Source:2)
at java.util.Optional.orElseGet(Optional.java:263)
at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.resolveSyncHttpClient(SdkDefaultClientBuilder.java:274)
at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.finalizeSyncConfiguration(SdkDefaultClientBuilder.java:225)
at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.syncClientConfiguration(SdkDefaultClientBuilder.java:158)
at software.amazon.awssdk.services.s3.DefaultS3ClientBuilder.buildClient(DefaultS3ClientBuilder.java:27)
at software.amazon.awssdk.services.s3.DefaultS3ClientBuilder.buildClient(DefaultS3ClientBuilder.java:22)
at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.build(SdkDefaultClientBuilder.java:129)
I got the same error working with timestream db. So in my case, timestreamWriteClient accepts ApacheHttpClient.Builder:
ApacheHttpClient.Builder httpClientBuilder =
ApacheHttpClient.builder();
return TimestreamWriteClient.builder()
.httpClientBuilder(httpClientBuilder)
.overrideConfiguration(overrideConfig.build())
.region(Region.US_EAST_1)
.build();
And on runtime, when app tries to create apache client, I got this error. So during some investigations, I found, that I can use another HTTP client - UrlConnectionHttpClient and pass it to TimestreamWriteClient.Builder.
httpClientBuilder: UrlConnectionHttpClient.Builder = UrlConnectionHttpClient.builder()
But this client should be included separately:
implementation 'software.amazon.awssdk:url-connection-client'
You can add version, adding ":X.Y.Z" at the end, but I use BOM, so I don't know anything about versions:
implementation platform('software.amazon.awssdk:bom:2.15.0')
So, I think, that you also can pass this HTTP client to your S3 service builder, like I'm doing this with timestreamWriteClient builder.
I recently started update to okhttp3 to 4.x
In doing so I am getting following build time error:
Using 'url(): HttpUrl' is an error. moved to val
The issue is happening when I am trying to get url from request object obtained via call:
e.g
call.enque(callback : Callback){
override fun onFailure(call : Call, t:Throwable) {
val url = call.request().url().toString
}
}
I looked up further and the Url object within Request is val aka final now.
Also, no directions on their upgrade guide https://square.github.io/okhttp/upgrading_to_okhttp_4/
I would appreciate for any suggestions on another way to obtain Url.
Using 'url(): HttpUrl' is an error. moved to val
This means you should change the function call url() to a property access url.
okhttp 4 comes with replaceWith param in the deprecation annotation that makes e.g. Android Studio to offer that fix automatically with right-click/alt-enter on the error:
#Deprecated(
message = "moved to val",
replaceWith = ReplaceWith(expression = "url"),
level = DeprecationLevel.ERROR)
From comments:
Upon further investigation I found out that the request() or Request object is from Retrofit 2. And Retrofit 2 returns call object from okhttp3
That's an issue with Android Studio. You can work around it with explicit cast to okhttp 4 types, e.g. (call.request() as Request).url.
In my case, I just had to remove the brackets:
call.request().url() -> call.request().url