aws-amplify/amplify-swift

Need to pass API-Key dynamically through APIPlugins in iOS

Santosh2332 opened this issue · 7 comments

Is your feature request related to a problem? Please describe.

I have added awsconfiguration.json file in my project for configuration, now i need to pass API Key dynamically to configure amplify like below code(OIDC Auth)

class MyAPIAuthProviderFactory: APIAuthProviderFactory {
    let myAuthProvider = MyOIDCAuthProvider()

    override func oidcAuthProvider() -> AmplifyOIDCAuthProvider? {
        return myAuthProvider
    }
}

class MyOIDCAuthProvider : AmplifyOIDCAuthProvider {
    func getLatestAuthToken() async throws -> String {
       ....
    }
}

try Amplify.add(plugin: AWSAPIPlugin(apiAuthProviderFactory: MyAPIAuthProviderFactory()))

Is there Any way to configure API-Key from my end like above example.

Describe the solution you'd like

Need to configure API-Key from project Swift class

Describe alternatives you've considered

Provide any alternative from your end

Is the feature request related to any of the existing Amplify categories?

API

Additional context

No response