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 6793629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:07:23+00:00 2026-05-26T18:07:23+00:00

While I am very experienced with the AppEngine/Python runtime, I am a newbie to

  • 0

While I am very experienced with the AppEngine/Python runtime, I am a newbie to the Go runtime. My first application is close to being ready to roll out, but I still need to provide a capability for the user to log in. I am hoping to use OpenID, as I would rather not require that the user have a Google Id.

However, it seems that there are no or almost no working examples out there, and the AppEngine documentation explicity omits the contents of the function that I need to implement:

func init() {
    http.HandleFunc("/_ah/login_required", openIdHandler)
}

func openIdHandler(w http.ResponseWriter, r *http.Request) {
    // ...
}

What goes inside the openIdHandler func?

I understand that I need to provide a page that will allow the user to select one of the many OpenId providers and enter their Id for that system. I just don’t know what to do after that. What is the workflow? Does anyone know of any sample code that I can look at to get a general idea of what I must do and what data I must handle? All of my well-honed google-fu has lead me nowhere.

To be clear, I am not looking to interact with any of the services provided by these OpenId providers; I do not wish to create Tweets or Buzz. I do not want access to contacts, docs, Wall postings or anything else. I just wanted an authenticated credenital that I can use inside my application to limit a users access to only his or her own data.

  • 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-05-26T18:07:24+00:00Added an answer on May 26, 2026 at 6:07 pm

    If I well understood you — you need openid, not oath.
    I rewrote python example (Federated login and logout) for go-lang. Hope this help.

    package gae_go_openid_demo
    
    import (
        "fmt"
        "os"
        "http"
    
        "appengine"
        "appengine/user"
    )
    
    func init() {
        http.HandleFunc("/", hello)
        http.HandleFunc("/_ah/login_required", openIdHandler)
    }
    
    func hello(w http.ResponseWriter, r *http.Request) {
        c := appengine.NewContext(r)
        u := user.Current(c)
        if u != nil {
            url, err := user.LogoutURL(c, "/")
            check(err);
            fmt.Fprintf(w, "Hello, %s! (<a href='%s'>Sign out</a>)", u, url)
        } else {
            fmt.Fprintf(w, "Please, <a href='/_ah/login_required'>login</a>.")
        }
    
    }
    
    func openIdHandler(w http.ResponseWriter, r *http.Request) {
        providers := map[string]string {
            "Google"   : "www.google.com/accounts/o8/id", // shorter alternative: "Gmail.com"
            "Yahoo"    : "yahoo.com",
            "MySpace"  : "myspace.com",
            "AOL"      : "aol.com",
            "MyOpenID" : "myopenid.com",
            // add more here
        }
    
        c := appengine.NewContext(r)
        fmt.Fprintf(w, "Sign in at: ")
        for name, url := range providers {
            login_url, err := user.LoginURLFederated(c, "/", url)
            check(err);
            fmt.Fprintf(w, "[<a href='%s'>%s</a>]", login_url, name)
        }
    }
    
    // check aborts the current execution if err is non-nil.
    func check(err os.Error) {
        if err != nil {
            panic(err)
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am not very experienced with VB.NET but I have to build an application
I've been using VMWare for a while and am very happy with it, but
Hi im a complete newbie and this may seem very simple to any experienced
A while back I overheard some very experienced web developer describe an ideal (in
I've noticed a lot of Microsoft sites have the *.MSPX extension. While I'm very
I am fairly new to using infragistics controls (started yesterday). While they are (very)
While it would be very convenient to use inline functions at some situations, Are
While dabbling in Clojure I've written a very basic program to echo whatever the
while doing some homework in my very strange C++ book, which I've been told
While computer programming evangelists predicting the future of Cloud Computing to be very bright,

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.