Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/previousdeveloper/retrofit.oauth-2

Simple OAuth2 Resource Owner Password Credentials Example
https://github.com/previousdeveloper/retrofit.oauth-2

Last synced: about 1 month ago
JSON representation

Simple OAuth2 Resource Owner Password Credentials Example

Awesome Lists containing this project

README

        

# Retrofit-OAuth-2-Resource-Owner-Password-Credentials
Simple OAuth2 Resource Owner Password Credentials.

#GetAccessToken

This will add the necessary oAuth headers to each request.
```java
public interface IOauthService {

@POST("/oauth/token")
void getAccessToken(@Body AccessTokenRequest accessTokenRequest,
Callback responseCallback);
}
```

#Send Token Every Request

```java
RequestInterceptor requestInterceptor = new RequestInterceptor() {
@Override
public void intercept(RequestFacade request) {
request.addHeader("Authorization", "Bearer" + token);
request.addHeader("User-Agent", "Android");
}
};
```