QR codes from API not working?

576 views
Skip to first unread message

g8rf...@gmail.com

unread,
Jun 24, 2015, 2:25:28 PM6/24/15
to lin...@googlegroups.com
I'm using admin/init and getting back a json response that looks good. In the "detail.googleurl.img" element, I get an html object like <img width=250 src="data:image/png;base64,iVBORw0KG.......

If I put that image in a web page it looks like a good QR code but when I scan it with Google Authenticator, the app says it can't interpret the QR code.

I've also tried taking the detail.googleurl.value which looks like "otpauth://totp/....." and add that to "http://chart.apis.google.com/chart?...yadda, yadda" but again I get a QR code that looks good but Google Authenticator can't interpret it.

Any ideas? Has anyone actually got working QR codes from the API?

Thanks!

Mirko Ahnert

unread,
Jun 25, 2015, 8:22:25 AM6/25/15
to lin...@googlegroups.com, g8rf...@gmail.com
Hi,

please add otplen=6 to your admin/init call. This makes the token compatible to Google Authenticator & CO. 

Additionally you could try to use qr=img or qr=png - that will directly return the QR code (this needs python-qrcode and python image lib installed)

Best regards,

Mirko

-- 
Mirko Ahnert 
LSE Leading Security Experts GmbH, http://www.lsexperts.de 
Postfach 100121, 64201 Darmstadt, Germany 
Zentrale: +49 6151 86086-0 , Fax: -299 
Support Hotline: +49 6151 86086-115 
Unternehmenssitz: Weiterstadt Amtsgericht Darmstadt: HRB8649 
Geschäftsführer: Oliver Michel, Sven Walther 

g8rf...@gmail.com

unread,
Jun 25, 2015, 12:52:36 PM6/25/15
to lin...@googlegroups.com, g8rf...@gmail.com
Thank you for the suggestions but those didn't work, unfortunately. Same thing with a good looking QR code that Google Authenticator can't interpret.

Here's what my admin/init string looks like:
https://linotpserver/admin/init?otplen=6&genkey=1&user=testuser&realm=myrealm&tokenrealm=myrealm&type=TOTP&session=.......

It does create a token for the user and I've noticed that a token created by this method has a serial prefix of "TOTP" whereas if generated by the self service webUI, it's "LSGO".

Also, my self service policy includes "webprovisionGOOGLEtime" in the actions. Maybe that does something special? Is there and equivalent that I can pass to the API?

g8rf...@gmail.com

unread,
Jun 25, 2015, 3:36:54 PM6/25/15
to lin...@googlegroups.com, g8rf...@gmail.com
Update: I got it working! I changed "type=TOTP" to "type=totp". It seems to require lower case to work properly. I left the "otplen=6" in there and didn't try it without.
Message has been deleted

Kay Winkler

unread,
Jun 29, 2015, 5:10:30 AM6/29/15
to lin...@googlegroups.com
Dear Madmous,

I think you switched the otpkey with the genkey:

- genkey=1 means create a seed for me
- otpkey=1 is a very small seed though ;-)


Best regards,

Kay



Am 28.06.2015 um 15:48 schrieb Moustapha Amadou Diouf:
> Hello,
>
> I am trying to generate a TOTP token and I am getting "Odd-length
> string" error.
> Would you mind sharing your init request so I can understand why I can't
> do it proprely.
>
> Here is my request :
>
> http://localhost:5001/admin/init?otpkey=1&type=totp&session="+cookieValue
>
>
> I can see in the LinOTP admin session (server/manage) that the token is created but I can't extract it if I have an error after the call.
>
>
> Thank you very much.
>
> Best reguards.
>
> Madmous.
>
> --
> You received this message because you are subscribed to the Google
> Groups "LinOTP" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to linotp+un...@googlegroups.com
> <mailto:linotp+un...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/linotp.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/linotp/18d84ce9-307a-4ea5-8389-b6c90b5066b2%40googlegroups.com
> <https://groups.google.com/d/msgid/linotp/18d84ce9-307a-4ea5-8389-b6c90b5066b2%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

--
Kay Winkler (Software Development) <Kay.W...@lsexperts.de>
Mobil: +49 1751 874 258, Phone: +49 6151 860 86 262, Fax: 299

LSE Leading Security Experts GmbH, Postfach 100121, 64201 Darmstadt
Geschäftsführer: Oliver Michel, Sven Walther, http://www.lsexperts.de
Unternehmenssitz: Weiterstadt, Amtsgericht Darmstadt: HRB8649

0x6387B5D1.asc
Kay_Winkler.vcf
signature.asc

Moustapha Amadou Diouf

unread,
Jun 29, 2015, 8:24:38 AM6/29/15
to lin...@googlegroups.com, Kay.W...@lsexperts.de
Hello Kay,

I am so bad at posting. Every time I'm done and I submit the question, I end up finding the answer.
It did not take me long to figure it out and make a Java application that uses LinOTP API completly for double authentication.

Thank you very much.
Best regards.
Reply all
Reply to author
Forward
0 new messages