Accessing ASP.NET API From Android with OAuth 2.0 (using RetroFit 2.0)

koeks525

Executive Member
Joined
Jul 14, 2012
Messages
5,315
Hi guys,

I am a little stressed and confuzzled right now. I have this Android app I had been building all this time. The app now needs to access data through an API. The API has OAuth 2.0 Authorization (this was set on Azure).

From what I understand, to access data from this API, I need to send a Client ID together with a secret. Once these are sent to the server, a token will be sent back to me.

I did a little googling around this and found this link, which goes around doing this using RetroFit and OkHttp: https://futurestud.io/blog/oauth-2-on-android-with-retrofit

When following the steps in this article, the android app does ask the user to open their browser, authorize the app (this is through an intent). After the user has authorized this, the browser is supposed to close and focus should go back to the android app... that is the part that isn't working for me.

Has anyone else had to use an API with OAuth 2.0 authentication? What would you have done?

I am trying to find similar implementations of this on the net so I can see what else I can try.
 

[)roi(]

Executive Member
Joined
Apr 15, 2005
Messages
6,282

Thor

Honorary Master
Joined
Jun 5, 2014
Messages
44,236
[)roi(];18243247 said:
The process is fairly simple once you understand the basics.

If you're a little grey on the subject, then I suggest you search on youtube for step by step demos: here's e.g. a easy to understand PHP example, different language, but the process is the same: https://www.youtube.com/watch?v=io_r-0e3Qcw
Here's a simple Google OpenID example: http://256stuff.com/gray/docs/oauth2.0/

oauth.net also has a few easy to follow examples: https://oauth.net/getting-started/

I love you
 
Top