Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8462649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:13:29+00:00 2026-06-10T14:13:29+00:00

Summary: I’m trying to use stored Google accounts on an Android application to authenticate

  • 0

Summary: I’m trying to use stored Google accounts on an Android application to authenticate users in a native application, with an API provided by a Rails 3 + Devise application, and I’m stuck.

Details:
We have an application (http://push-poll.com) which lets users gather feedback from a bunch of their friends. We’ve also built a native Android application. Our web app allows you to log in with your Google account, and we want to extend that functionality to the native Android app. The web app accomplishes this with Devise (for account permissions) + Omniauth (for Google account info and OAuth interaction).

Versions:
Android 2.1+, Rails 3.2.2, Devise 2.1.2, Omniauth 1.1.0

Proposed authentication workflow:

  1. User hits “log in with Google account” on Android application
  2. User selects a stored account on Android device using AccountManager and gives permission
  3. Android app sends Google account token to Rails API
  4. Rails app sends account token to Google OAuth API <– This is where I’m stuck
  5. Google returns success and account information (specifically, name + email)
  6. Rails app find/create user by email address
  7. Rails app create/read/update access token from user account
  8. Rails access token is retuned to Android app (this is how our app currently handles api access with standard login)
  9. Android app includes Rails access token in all API calls

I’ve scoured Google’s documentation, but I am totally stuck on (4) and (5). Once I have the Google-provided email address, everything works as it does now (for either standard logins or Google/Omniauth/Devise accounts). By my best guess, this can be solved with either of the following:

  • Create an API/secret key for the Android app that is shared with a web app, in order to make requests of the Google Accounts API
  • Find a Google API endpoint I can simply authenticate an Android account token against and return account details

I’ve been banging my head against a wall on this one for at least a week.

FYI: I’m the web dev, and our Android dev has been kind enough to furnish me with a stubbed-out Android app that’ll send an access token from Android to the API endpoint of my choosing.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T14:13:31+00:00Added an answer on June 10, 2026 at 2:13 pm

    OK, so I was able to resolve this with a little better understanding of OAuth. Apparently tokens are able to be passed around between different servers and it doesn’t really matter who holds them, they continue to function.

    So, using Android’s AccountManager I was able to extract a token with sufficient permissions for the scope userinfo.email, and then sending that to the server. Then the server can hit:

    https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=TOKENVALUE

    Note: This is being sent to the Rails app via HTTPS – you should never send a token over the internet in clear text.

    Here’s a partial clip of how we do this:

    # Use Google's Token Verification scheme to extract the user's email address
    token = params[:token]
    uri = URI.parse("https://www.googleapis.com")
    http = Net::HTTP.new(uri.host, uri.port)
    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
    path = "/oauth2/v1/tokeninfo?access_token=#{token}"
    resp, data = http.get(path)
    data = JSON.parse(data)
    if resp.code == "200"
      # Find a user
      @user = User.where(:email => data["email"]).first
      if !@user
        #Create a user with the data we just got back
      end
    else
      # Bad or revoked token 
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Summary We have an ASP.NET application that allows users to query a SQL Server
Summary: I am trying to use asp.net membership, roles, and profiles, but am having
Summary: I want to display a value (in a text box) stored in another
Summary: I'm trying to write a text string to a column of type varchar(max)
SUMMARY How can I make my GUI application run on windows startup on a
I am trying to understand how to use SyndicationItem to display feed which is
Summary Amazingly I could find nothing about this on Google or SO. When I
Summary: ASP.Net website with a couple hundred users. Data is exported to Excel files
Summary I have a web-application with more than 5 themes. Each themes covers a
Summary: How do I configure my facebook application to request additional information from the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.