Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/previousdeveloper/retrofit.oauth-2
- Owner: previousdeveloper
- License: mit
- Created: 2015-04-08T06:20:57.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-06-28T10:12:03.000Z (over 9 years ago)
- Last Synced: 2024-04-14T13:53:00.287Z (7 months ago)
- Language: Java
- Homepage:
- Size: 218 KB
- Stars: 11
- Watchers: 3
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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");
}
};
```