Skip to content
Browse files

Dropbox authorization fixed.

  • Loading branch information...
1 parent 3dec1d9 commit fb3645f6ba6d00881ade2dd52fd3cfadb1a0c97e @stepankuzmin committed Apr 6, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/blog.erl
View
8 src/blog.erl
@@ -15,6 +15,7 @@ box(Str) ->
out(Arg) ->
case Arg#arg.appmoddata of
%% "" -> list(Arg);
+ "create/stepan" -> create(Arg);
"login" -> signup(Arg);
"account/info" -> account_info(Arg);
_ ->
@@ -30,11 +31,14 @@ out(Arg) ->
%% ROUTES
+create(_Arg) ->
+ simple:start("stepan"),
+ {redirect, "http://stepan:8888/"}.
+
signup(_Arg) ->
[{"oauth_token_secret", TokenSecret}, {"oauth_token", Token}] = dropbox:request_token(?KEY, ?SECRET),
mnesia:transaction(fun() -> mnesia:write(#token{token=Token, tokensecret=TokenSecret}) end),
- [{_, Link}] = dropbox:authorize(?KEY, ?SECRET, Token, TokenSecret, "http://localhost:8888/blog/account/info"),
- {redirect, Link}.
+ {redirect, "https://www.dropbox.com/1/oauth/authorize?oauth_token=" ++ Token ++ "&oauth_callback=http://localhost:8888/blog/account/info"}.
account_info(Arg) ->
[{"uid", _Uid}, {"oauth_token", Token}] = yaws_api:parse_query(Arg),

0 comments on commit fb3645f

Please sign in to comment.
Something went wrong with that request. Please try again.