4 messages in com.googlegroups.bloggerdevRe: Check Login| From | Sent On | Attachments |
|---|---|---|
| Ashutosh | 07 Feb 2008 04:03 | |
| Jeff Scudder | 08 Feb 2008 16:02 | |
| Ashutosh | 10 Feb 2008 20:30 | |
| Jeff Scudder | 11 Feb 2008 17:51 |
| Subject: | Re: Check Login![]() |
|---|---|
| From: | Jeff Scudder (j....@google.com) |
| Date: | 02/11/2008 05:51:16 PM |
| List: | com.googlegroups.bloggerdev |
On Feb 10, 8:30 pm, Ashutosh <vyas...@gmail.com> wrote:
Well,
I checked this from my own blogger account.
I logged in to my blogger account, then went to my blog through "View My Blog".
This way I hope it is authenticated. Isnt it.
No, your Blogger API code needs to authenticate separately since it is in it's own domain and doesn't use the cookies for Blogger's website. I wrote up a short example which uses AuthSub browser redirects to login and gain access to the feeds. You might want to use something like the below two functions, logIn redirects your browser to sign in.
function checkLogin() { var scope = "http://www.blogger.com/feeds"; var token = google.accounts.user.checkLogin(scope);
alert(token); };
function logIn() { var scope = "http://www.blogger.com/feeds"; var token = google.accounts.user.login(scope); };
Happy coding,
Jeff
Thanks Ashutosh
On Feb 9, 5:02 am, Jeff Scudder <j....@google.com> wrote:
On Feb 7, 4:04 am, Ashutosh <vyas...@gmail.com> wrote:
Hi
I am new to JS API for Blogger. Currently What I did was simple went to Edit HTML for my blog and inserted the script for developer key and load data in the Head section as below:
<script type="text/javascript" src="http://www.google.com/jsapi?key=developer_key"> </script>
<script type="text/javascript"> google.load("gdata", "1"); </script>
Then I have a button which has the following code:
<script type="text/javascript"> function checkLogin() { scope = "http://www.blogger.com/feeds"; var token = google.accounts.user.checkLogin(scope);
alert(token);}
</script> <input value="Work In Progress" onclick="javascript:checkLogin()" type="button"/>
My problem is that whether I am logged in to blogger or not, it always shows a BLANK alert.
Can anybody help me out on this.
THanks Ashutosh
Hi Ashutosh,
I think the reason that google.accounts.user.checkLogin will return an empty string (which evaluates as false in if statements, loops, etc.) if you are not authenticated. If you are authenticated, you should receive the token back from google...checkLogin. Does it work if you include a call to google.accounts.user.login(scope)?
Thank you,
Jeff- Hide quoted text -
- Show quoted text -




