Skip to content

previousdeveloper/Retrofit.OAuth-2

Repository files navigation

Retrofit-OAuth-2-Resource-Owner-Password-Credentials

Simple OAuth2 Resource Owner Password Credentials.

#GetAccessToken

This will add the necessary oAuth headers to each request.

  public interface IOauthService {

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

#Send Token Every Request

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

About

Simple OAuth2 Resource Owner Password Credentials Example

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages