Explore our sample app
Get the sample code used during this guide, you can either download it our explore it directly on GitHub.
Download Code View on Github

Building a server-side (Java/Spring Boot) app


This guide will walk you through the process of logging in with Arkane using Single Sign On and displaying your Arkane wallets. This specific guide will focus on Spring Boot integration. After this intro you will understand the different Arkane components and be able to integrate all features from Reference documentation.

What you’ll build

We’ll build a small application which will:

  • Allow us to authenticate using your Arkane Account (OAuth2)

  • Fetch and display your wallets, server side

In this example, the following components will be used Arkane Identity Arkane API.


  • A text editor or IDE

  • Java 10+ and Maven must be installed

Let’s get started

We’ll start by creating a new Java project

mkdir ui && cd ui
$ curl https://start.spring.io/starter.tgz -d style=web -d name=simple | tar -xzvf -

Enabling Arkane Login

To be able to log in using Arkane, we’ll have to add OAuth2 support to our Spring Boot application.


Adding Oauth2 Support

First of all, we’ll need to enable oauth2 support. Simply add @EnableOAuth2Client and autowire OAuth2ClientContext in a configuration class.

public AuthorizationCodeResourceDetails  arkane() { (1)
    return new AuthorizationCodeResourceDetails();
1 Next up, we’ll create a new instance of AuthorizationCodeResourceDetails and provide it as a bean. We’ll also populate our application with properties from a property file. In this example, we’re using the Arkane Staging environment using a public client we use for every guide (Arketype)

On top of that we’ll have to add the properties for the resource server.

public ResourceServerProperties arkaneResource() {
    return new ResourceServerProperties();

Make one of your configuration classes extend from WebSecurityConfigurerAdapter and implement the configure method.

protected void configure(HttpSecurity http) throws Exception {
    .addFilterBefore(ssoFilter(), BasicAuthenticationFilter.class);

The last thing we’ll need to do is create a filter and a FilterRegistrationBean, which we’ll add to our web security configuration. This will make sure that the endpoints require our SSO authentication. Our FilterRegistrationBean will make sure that the application will redirect us to Arkane to be able to login.

private Filter ssoFilter() {
    OAuth2ClientAuthenticationProcessingFilter arkaneFilter = new OAuth2ClientAuthenticationProcessingFilter("/login/arkane");
    OAuth2RestTemplate facebookTemplate = arkaneTemplate();
    UserInfoTokenServices tokenServices = new UserInfoTokenServices(arkaneResource().getUserInfoUri(), arkane().getClientId());
    return arkaneFilter;

public FilterRegistrationBean<OAuth2ClientContextFilter> oauth2ClientFilterRegistration(OAuth2ClientContextFilter filter) {
    FilterRegistrationBean<OAuth2ClientContextFilter> registration = new FilterRegistrationBean<>();
    return registration;

Calling the Arkane API: Server Side

Now that a user is authenticated, we can leverage the power of Spring OAuth2. Calling the Arkane Rest APIs only requires you to provide and autowire an instance of OAuth2RestOperations.

Somewhere in the configuration file you created before, you can simply add the following.

public OAuth2RestTemplate arkaneTemplate() {
    return new OAuth2RestTemplate(arkane(), oauth2ClientContext);

You can now safely autowire this instance anywhere to call the rest API using the credentials of the user that is logged in.

private OAuth2RestOperations oAuth2RestOperations;

public String wallets() {
    return oAuth2RestOperations.getForObject("https://api-staging.arkane.network/api/wallets", String.class);


Congratulations! You’ve just built an small service-side application app that is able to:

  • We authenticated using your Arkane Account (OAuth2)

  • We fetched and displayed your wallets, server side

In this example, the following components were used Arkane Identity Arkane API.

The sample code used during this guide can either be downloaded or explored on GitHub.

What’s next

Now that you’ve mastered the basics you can dive deeper in the different building blocks or explore all our functionalities.

If at any time you get stuck and need some help or advise, don’t hesitate to join our Telegram channel, we are glad to help!