Android OAuth2 Client Credentials

I have an application that uses an API.

The API uses OAuth2, and I would like to use the library to work with OAuth for me. I have CLIENT_ID and CLIENT_SECRET, and the grant type is "client_credentials".

Currently, I am doing everything myself: using HttpUrlConnection, I request a token and I save it. I am adding a token to the HttpUrlConnections headers of the following calls, and it works well.

I would like to create a module that wraps the API, and which will make it easier to change the type of grant in the future, and for this I need the OAuth2 library, which supports the types of providing implicit and client credentials, with some guidelines on how to use it.

What I tried:

  • oauth java client , but I can't figure out how to start using it.
  • scribe , but it looks like it's focused on an implicit grant and is not available to me right now.
  • retrofit , which I would like to avoid now.
+4
source share

Source: https://habr.com/ru/post/1614713/


All Articles