Using Google OAuth to secure web services in aspnet core

Viewed 1274

I'm getting lost in OAuth and OpenIDConnect and aspnet core middleware. Any help on this would be appreciated.

I have multiple UIs (web, native apps) that use the same set of web services, and I'd like to ensure only authenticated users can access the web services. My organization uses Google accounts, so I'd like to use Google authentication restricted to the organization domain.

The web site is properly requiring authentication, following this sample. What I need now is to have the web site (AngularJS 4) invoke my back end web services with an auth token that I can verify with Google.

The back end services are written with aspnet core. I've tried using these approaches: Google middleware and Google OpenIDConnect but these still 1) assume there is a UI that can prompt an unauthorized user to log in, and 2) appear to be cookie-based, and I won't have cookies for the web service calls.

I don't want to prompt the user to log in, since the "user" in this case is a software client. Either they're authenticated or not already. I just need to get the authentication token, validate it, and carry on.

This appears to be the same question, which hasn't been answered yet, either.

Any suggestions are appreciated. Also, suggestions or tips on having native apps do the same!

2 Answers
Related