如何使用 Retrofit Android 进行 OAuth 2.0 [英] How to OAuth 2.0 with Retrofit Android

查看:24
本文介绍了如何使用 Retrofit Android 进行 OAuth 2.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Retrofit 库,我想在每个 API 调用上实施 OAuth 2.0 以验证这些调用.我怎样才能做到这一点?你能一步一步解释我吗?我关注了一些博客,但不明白如何做到这一点.

I'm using Retrofit library and I wanted to implement OAuth 2.0 on every API call in order to authenticate those calls. How can I achieve that? Can you explain me step by step? I have followed some blogs but didn't understand how to do that.

推荐答案

我强烈建议您查看 u2020 源代码.如果您继续使用 Retrofit 1.x,您可以使用 OkHttp 拦截器(Retrofit 1.x 或 Retrofit 2.x)或 RequestInterceptor 来实现这一点.

I highly recommend you to check u2020 source code. You can achieve this with a OkHttp interceptor (Retrofit 1.x or Retrofit 2.x) or a RequestInterceptor if you stay with Retrofit 1.x.

这篇关于如何使用 Retrofit Android 进行 OAuth 2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆