diff options
3 files changed, 16 insertions, 6 deletions
diff --git a/samples/OpenIdRelyingPartyWebForms/MembersOnly/DisplayGoogleContacts.aspx b/samples/OpenIdRelyingPartyWebForms/MembersOnly/DisplayGoogleContacts.aspx index cd17720..7d5a54f 100644 --- a/samples/OpenIdRelyingPartyWebForms/MembersOnly/DisplayGoogleContacts.aspx +++ b/samples/OpenIdRelyingPartyWebForms/MembersOnly/DisplayGoogleContacts.aspx @@ -4,8 +4,13 @@ <asp:Content ID="Content1" runat="server" ContentPlaceHolderID="Main"> <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0"> <asp:View ID="View1" runat="server"> - Obtain an access token by <asp:HyperLink NavigateUrl="~/loginPlusOAuth.aspx" runat="server" - Text="logging in at our OpenID+OAuth hybrid login page" />. + <p>Obtain an access token by <asp:HyperLink NavigateUrl="~/loginPlusOAuth.aspx" runat="server" + Text="logging in at our OpenID+OAuth hybrid login page" />. </p> + <p>If you've already done that, then you might have inadvertently clicked "Allow [this + site] to remember me", which causes Google to stop sending the access token that + this sample doesn't save. If you did check it, you can restore this sample's + functionality by <a href="https://www.google.com/accounts/IssuedAuthSubTokens">revoking + access</a> to this site from your Google Account. </p> </asp:View> <asp:View ID="View2" runat="server"> <h2>Address book</h2> diff --git a/samples/OpenIdRelyingPartyWebForms/MembersOnly/DisplayGoogleContacts.aspx.cs b/samples/OpenIdRelyingPartyWebForms/MembersOnly/DisplayGoogleContacts.aspx.cs index a221204..41830af 100644 --- a/samples/OpenIdRelyingPartyWebForms/MembersOnly/DisplayGoogleContacts.aspx.cs +++ b/samples/OpenIdRelyingPartyWebForms/MembersOnly/DisplayGoogleContacts.aspx.cs @@ -12,7 +12,11 @@ protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(State.GoogleAccessToken)) { MultiView1.ActiveViewIndex = 1; - emailLabel.Text = State.FetchResponse.Attributes[WellKnownAttributes.Contact.Email].Values[0]; + if (State.FetchResponse != null && State.FetchResponse.Attributes.Contains(WellKnownAttributes.Contact.Email)) { + emailLabel.Text = State.FetchResponse.Attributes[WellKnownAttributes.Contact.Email].Values[0]; + } else { + emailLabel.Text = "unavailable"; + } claimedIdLabel.Text = User.Identity.Name; var contactsDocument = GoogleConsumer.GetContacts(Global.GoogleWebConsumer, State.GoogleAccessToken); this.RenderContacts(contactsDocument); diff --git a/samples/OpenIdRelyingPartyWebForms/loginPlusOAuth.aspx b/samples/OpenIdRelyingPartyWebForms/loginPlusOAuth.aspx index 7e588bc..57bca52 100644 --- a/samples/OpenIdRelyingPartyWebForms/loginPlusOAuth.aspx +++ b/samples/OpenIdRelyingPartyWebForms/loginPlusOAuth.aspx @@ -8,9 +8,10 @@ <h2>Login Page </h2> <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex='0'> <asp:View ID="View1" runat="server"> - <p><b>Important note:</b> Do <b>not</b> check the "Allow [this site] to remember me" - check box. Doing so will make this sample only work once for your account. If you - do check it, you can restore this sample's functionality by <a href="https://www.google.com/accounts/IssuedAuthSubTokens"> + <p><b>Important note:</b> Do <b>not</b> check the "Allow [this site] to remember me" + check box while Google is asking for verification. Doing so will make this + sample only work once for your account. If you do check it, you can restore this + sample's functionality by <a href="https://www.google.com/accounts/IssuedAuthSubTokens"> revoking access</a> to this site from your Google Account. </p> <asp:Button ID="beginButton" runat="server" Text="Login and get Gmail Contacts" OnClick="beginButton_Click" /> <p>Due to the way Google matches realms and consumer keys, this demo will only work |