언어 설정

Menu
Sites
Language
Is it possible to use Oauth2.0 in Native programming

Hi, 

Just want to know, is it possible to use Oauth2.0 in Native programming, I have check some web server, they didn't have the interface for Tizen, almost for ios and android. I want to know if they didn't have the API interface for C/Tizen, how to do the such operation?

Responses

10 댓글
Alex Dem

Hi,
Afaik, it is possible if you will use WebView: https://developer.tizen.org/dev-guide/2.3.0/org.tizen.tutorials/html/native/web/web_tutorials_n.htm ,
using Web View you could try to login in any system which using oath 2 ( You should specify the redirect url in some manner). After this you will able to control and extract access token wich comes to redirct url. You could save it and use until it expires. But I not familiar with the details.
Alexey

Mats Wichmann

The current (Tizen 2.3) library does OAuth 1.0.

 

Jean Yang

Thanks you, guys, that means there is no avaiable Native API for OAuth 2.0?

But as my understanding, we still can try some operation like we do the OAuth2.0 login in broswer,  is this possible?

Alex Dem

Hi,
Looks like If you need your own login/password screen (based on Native UI) you should use http://liboauth.sourceforge.net/index.html integrated into Tizen (which supports oauth 1.0). In this case you should create and sign http requests with this lib (which uses Curl also) , also you should manage tokens obtaining. But I did not check how to  get access tokens wich comes to redirect url in details (Maybe you need use Web View  also).

If you perfrom your athorization via browser (Web View) it looks simpler. All you need is compose some url and open it in Web View (url should contains appId, redirect url etc). After this site should forward you to authoriztion page, after login (when url is changed from authoriztion page to redirect url) you should get access_token on redirect url page in Web View.

p.s. I have faced with OAuth problem for Web apps in prev Tizen versions (2.2.1 and early) and as I remember Oauth was impossible for Web apps.
Alexey.

Jean Yang

Thanks Alex!

Thanks your usefual infomation, as you said, the web apps has some problem and seems impossible to implement the OAuth 2.0, I'll try in the native way, I think if the Native APP can call the broswer and do the operation like you mentioned, that's a possiable way.

Alex Dem

Hi,
In Web apps OAuth is not possible because of  Web app  is located on filesystem of device but 'redirect url' should be hosted somewhere in internet. Hence site which supports OAuth can't open 'redirect url' (page) located on filesystem.
But from Web app located on filesystem you have no access to 'redirect url' which is located in internert (due Same Origin Policy) . 
Even you will use iframe tag to load 'redirect url' inside Web app, you will unable to obtain tokens.
Alexey.

Mats Wichmann

Hmmm, Google doesn't seem to agree with this.  Is this issue something special to Tizen?

https://developers.google.com/identity/protocols/OAuth2InstalledApp

 

Alex Dem

Hi,
As I remeber we was unable for Vimeo client due callback url exactly. In any case I can't find any example how to perform oauth for Web apps for Tizen.
Alexey.

Alex Dem

Also, Tizen Web apps are launched with Web Runtime (WRT) engine outside of browser. It could be a cause of some restrictions.
Alexey.

Jean Yang

Thanks guys,  I used the native web view to implement, and now I can got the access token.