Atlassian

Get your Credentials

  1. Sign in to your Atlassian account and go to the Atlassian Developer Console
  2. Click "Create new app"
  3. Fill out the app details
  4. Configure your redirect URI (e.g., https://yourdomain.com/api/auth/callback/atlassian)
  5. Note your Client ID and Client Secret

Make sure to set the redirect URI to match your application's callback URL. If you change the base path of the auth routes, you should update the redirect URI accordingly.

Configure the provider

To configure the provider, you need to import the provider and pass it to the social_providers option of the auth instance.

config/auth.rb
require "better_auth"

auth = BetterAuth.auth(
secret: ENV.fetch("BETTER_AUTH_SECRET"),
base_url: ENV.fetch("BETTER_AUTH_URL", "http://localhost:3000"),
social_providers: {
atlassian: BetterAuth::SocialProviders.atlassian(
  client_id: ENV.fetch("ATLASSIAN_CLIENT_ID"),
  client_secret: ENV.fetch("ATLASSIAN_CLIENT_SECRET")
)
}
)

Sign In with Atlassian

To sign in with Atlassian, call auth.api.sign_in_social on your Ruby auth instance. The endpoint body takes the following properties:

  • provider: The provider to use. It should be set to atlassian.
server.rb
response = auth.api.sign_in_social(
body: {
provider: "atlassian",
callback_url: "/dashboard",
error_callback_url: "/login",
disable_redirect: true
}
)

redirect_url = response.fetch(:url)

For more information about Atlassian's OAuth scopes and API capabilities, refer to the official Atlassian OAuth 2.0 (3LO) apps documentation.

On this page