Getting Started

Try “OAuth 2.0 Authorization Flow” Using Authlete.

1. Create Your Account.

Fill in the registration page and click Sign Up.

2. Check Your Inbox.

You will get an email from Authlete, describing instructions on how to try the OAuth 2.0 flow.
💡 You can try OAuth 2.0 flow right after the signup. The following settings have been configured:
  • An Authlete service instance
  • A default OAuth 2.0 authorization endpoint
  • Sample client application settings

3. Click "Authorization Endpoint" Button.

You will be navigated to a login page for authentication and authorization.

💡 The "Authorization Endpoint" button in the email will invoke an authorization request (implicit grant flow) from your Web browser to Authlete's default authorization endpoint. The actual URL of the request is:

https://api.authlete.com/api/auth/authorization/direct/<SERVICE_API_KEY>?response_type=token&client_id=<SAMPLE_APP_CLIENT_ID>

4. Enter Login Information.

Use the API key and secret of your Authlete service instance.
💡 For testing purposes, the default authorization endpoint authenticates a user with the API key and secret.

5. Click “Authorize” Button.

Your browser will be redirected to the client's redirection endpoint that shows an issued access token.

You can find the same access token in the fragment part of the destination URL.

https://api.authlete.com/api/mock/redirection/<SERVICE_API_KEY>#access_token=SNqzo...&token_type=Bearer&expires_in=86400&scope=

Congratulations! You successfully issued your first access token using Authlete!

Try “Authorization Code Grant Flow”

Try “Authorization Code Grant Flow” in addition to Implicit Grant Flow in the previous section.

1. Enter the following URL (authorization request) to your Web browser and submit it.

https://api.authlete.com/api/auth/authorization/direct/<SERVICE_API_KEY>?response_type=code&client_id=<SAMPLE_APP_CLIENT_ID>

This request is the same as the previous one except response_type=code. Replace <SERVICE_API_KEY> / <SAMPLE_APP_CLIENT_ID> to the appropriate values in your environment.

2. You will be navigated to the login page. Enter the API key and the secret.

3. Your browser will be redirected to the client's redirection endpoint. Enter the value of SAMPLE_APP_CLIENT_ID to client_id field and click “Submit” button to make a token request.

4. Token response (JSON formatted) will be displayed. There should be values for "access_token" and "refresh_token".

Authorization Server Implementations

In the previous section, you tried the flow using the default implementation of authorization endpoint. For real deployments, you have freedom of choice to implement your own authorization server using Authlete Web APIs.

java-oauth-server is an open-source authorization server written using Authlete Web APIs. It is the reference implementation in Java and a good starting point for your own authorization server implementation.

This reference implementation uses Authlete as its backend so that it can eliminate efforts to set up a database server as storage of authorization data (e.g. access tokens), configuration data of the authorization server itself as well as client application settings communicating with the server.

So you can download and start the authorization server only with a few commands as shown below:

Please check the documents at java-oauth-server for details.

$ git clone https://github.com/authlete/java-oauth-server.git
$ cd java-oauth-server
$ vi authlete.properties
$ mvn jetty:run

Please check the documents at spring-oauth-server for details.

$ git clone https://github.com/authlete/spring-oauth-server
$ cd spring-oauth-server
$ vi authlete.properties
$ mvn spring-boot:run

Please check the documents at csharp-oauth-server for details.

$ git clone https://github.com/authlete/csharp-oauth-server
$ cd csharp-oauth-server/AuthorizationServer
$ vi authlete.properties
$ dotnet run

Please check the documents at authlete-php-laravel for details.

$ laravel new authorization-server
$ cd authorization-server
$ composer require authlete/authlete-laravel
$ php artisan authlete:authorization-server
$ vi config/authlete.php

If you implement your own authorization server using Authlete Web APIs, you don’t have to implement an authentication callback endpoint, but instead you are required to customize some source files related to end-user authentication.