IT WORKS!!!!!!!

This commit is contained in:
Evert Prants 2020-06-01 20:34:42 +03:00
parent 941652e0f4
commit 2cd5727dfa
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
2 changed files with 12 additions and 12 deletions

View File

@ -86,14 +86,8 @@ defmodule Ueberauth.Strategy.IcyNet do
"""
def handle_request!(conn) do
scopes = conn.params["scope"] || option(conn, :default_scope)
send_redirect_uri = Keyword.get(options(conn), :send_redirect_uri, true)
opts =
if send_redirect_uri do
[redirect_uri: callback_url(conn), scope: scopes]
else
[scope: scopes]
end
opts = [redirect_uri: callback_url(conn), scope: scopes]
opts =
if conn.params["state"], do: Keyword.put(opts, :state, conn.params["state"]), else: opts
@ -137,7 +131,12 @@ defmodule Ueberauth.Strategy.IcyNet do
Fetches the uid field from the IcyNet response. This defaults to the option `uid_field` which in-turn defaults to `id`
"""
def uid(conn) do
conn |> option(:uid_field) |> to_string()
uid_field =
conn
|> option(:uid_field)
|> to_string
conn.private.icynet_user[uid_field]
end
@doc """
@ -149,9 +148,9 @@ defmodule Ueberauth.Strategy.IcyNet do
%Credentials{
token: token.access_token,
refresh_token: token.refresh_token,
expires_at: token.expires_at,
expires_at: nil,
token_type: token.token_type,
expires: !!token.expires_in
expires: false
}
end
@ -162,8 +161,8 @@ defmodule Ueberauth.Strategy.IcyNet do
user = conn.private.icynet_user
%Info{
name: user["username"],
nickname: user["display_name"],
name: user["display_name"],
nickname: user["username"],
email: user["email"],
image: user["image"],
}

View File

@ -74,6 +74,7 @@ defmodule Ueberauth.Strategy.IcyNet.OAuth do
def authorize_url(client, params) do
client
|> put_param("client_id", client.client_id)
|> put_param("response_type", "code")
|> put_param("redirect_uri", client().redirect_uri)
OAuth2.Strategy.AuthCode.authorize_url(client, params)