Commit 9ae213d Rohan Pujari
committed
1 parent 0e4048d commit 9ae213d Copy full SHA for 9ae213d
File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -42,9 +42,16 @@ defmodule Ueberauth.Strategy.Google do
42
42
end
43
43
end
44
44
45
+ @ doc """
46
+ Handles the callback for Google client side flow.
47
+ """
48
+ def handle_callback! ( % Plug.Conn { params: % { "token" => token } } = conn ) do
49
+ fetch_user ( conn , OAuth2.AccessToken . new ( token ) )
50
+ end
51
+
45
52
@ doc false
46
53
def handle_callback! ( conn ) do
47
- set_errors! ( conn , [ error ( "missing_code " , "No code received" ) ] )
54
+ set_errors! ( conn , [ error ( "missing_code_or_token " , "No code or token received" ) ] )
48
55
end
49
56
50
57
@ doc false
@@ -124,7 +131,7 @@ defmodule Ueberauth.Strategy.Google do
124
131
resp = Ueberauth.Strategy.Google.OAuth . get ( token , path )
125
132
126
133
case resp do
127
- { :ok , % OAuth2.Response { status_code: 401 , body: _body } } ->
134
+ { :error , % OAuth2.Response { status_code: 401 , body: _body } } ->
128
135
set_errors! ( conn , [ error ( "token" , "unauthorized" ) ] )
129
136
{ :ok , % OAuth2.Response { status_code: status_code , body: user } } when status_code in 200 .. 399 ->
130
137
put_private ( conn , :google_user , user )
You can’t perform that action at this time.
0 commit comments