Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Trying to add Google Authentication to AEM 6.5

Avatar

Level 1

Hi, 

 

I'm trying to use google's authentication jar file and including the following maven entries:

<dependency>
<groupId>com.google.auth</groupId>
<artifactId>google-auth-library-oauth2-http</artifactId>
<version>1.24.0</version>
</dependency>

This compiles on my IDE no issues, however after deploying to my dev environment, I run into a, 'cannot be resolved' issue on my bundle that requires this dependency.

How do I resolve these dependencies? 
I have so far tried creating a bundle via the instructions here: https://experienceleague.adobe.com/en/docs/experience-cloud-kcs/kbarticles/ka-17475 but have not had success in getting the oauth2 library imported or referenced in OSGI.

 

I also tried adding:

<Embed-Dependency>
google-auth-library-oauth2-http

as part of the embed dependency but this still claims it is unable to resolve the library.

 

I'd like some help in troubleshooting this as I am trying to use the GoogleCredentials to access Google's Vertex API.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

5 Replies

Avatar

Level 4

Hi @JasonLa6 

 

Actually it works in your IDE not in AEM, as OSGI fails to load the required.

Your IDE compiles the code because the dependency is in your classpath. But in AEM, OSGi classloading is modular, so every dependency must either:

  • Be provided by another installed OSGi bundle, or

  • Be embedded in your bundle with proper instructions.

Embed the dependency into your bundle

Add this to your pom.xml

<dependencies>
  <dependency>
    <groupId>com.google.auth</groupId>
    <artifactId>google-auth-library-oauth2-http</artifactId>
    <version>1.24.0</version>
  </dependency>
</dependencies>

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.felix</groupId>
      <artifactId>maven-bundle-plugin</artifactId>
      <extensions>true</extensions>
      <configuration>
        <instructions>
          <Embed-Dependency>google-auth-library-oauth2-http</Embed-Dependency>
          <Embed-Transitive>true</Embed-Transitive>
          <Import-Package>*</Import-Package>
        </instructions>
      </configuration>
    </plugin>
  </plugins>
</build>

Check if maven dependencies are also embedded if not you can add explicitly.

<Embed-Dependency>
  google-auth-library-oauth2-http,
  google-http-client,
  google-oauth-client,
  gson
</Embed-Dependency>

 

Hope this helpful.:)

 

Regards,

Karishma.

Avatar

Community Advisor

@JasonLa6 

You can create new module similar to core and include dependencies in it.

You need need to create an OSGi bundle out of third party non-osgi dependency using maven-bundle-plugin

Below article mentions all the steps for it

https://myaemlearnings.blogspot.com/2021/08/embedding-third-party-dependencyosgi.html


Amanath Ullah

Avatar

Level 1

I am trying to create a new bundle as mentioned in the link. I will report back if that loads the dependencies. Thank you.

Avatar

Administrator

@JasonLa6 Just checking in — were you able to resolve your issue? We’d love to hear how things worked out. If the suggestions above helped, marking a response as correct can guide others with similar questions. And if you found another solution, feel free to share it — your insights could really benefit the community. Thanks again for being part of the conversation!



Kautuk Sahni

Avatar

Level 1

Hi,

 

I've tried all the above responses already but I have not had luck in getting it to work as they describe. 

I am still troubleshooting on my end but so far the POM dependency embed is not working or likely misconfigured on my end. 

I am still working through the problem but the above options are not functioning as they say.

 

AEM 6.5 Service Package 6.5.15 is the version we're running on. I'll continue to work through this in this week.