yarrichar
yarrichar

Reputation: 423

oauth2: Android authentication against spring boot

I have an android application. I'm trying to use oauth2 to login my users, and provide access to my server. The server is written using spring boot. I'm using google as my social auth.

I think the flow is meant to be:

  1. Android app gets oauth token

  2. Android app passes this token to the spring boot app as a request property

  3. Spring boot takes the token and validates it.

I've successfully done (1) by following: https://developer.android.com/training/id-auth/authenticate.html

(2) is easy enough (example in above link)

My questions are:

  1. Is this correct?

  2. Where do I configure my api key with spring boot?

Upvotes: 3

Views: 2428

Answers (1)

yarrichar
yarrichar

Reputation: 423

So that flow is correct, or at least is working for me.

To get this working I needed to do two things:

  1. Change the value of the Authorization header in the example from OAuth to Bearer

  2. Add the filter from this other post: Spring Security OAuth2 - @EnableOauth2Sso but accept tokens as authentication, too

Upvotes: 1

Related Questions