MicrosoftGraph.Client (Microsoft Graph API Client v0.2.0)
Client for the Microsoft Graph API.
usage
Usage
client = Microsoft.Client.create("client_id", "client_secret", "tenant_id")
|> MicrosoftGraph.Client.get_token!(scope: "https://graph.microsoft.com/.default")
MicrosoftGraph.Users.User.list_users(client)
# {:ok, response}
MicrosoftGraph.Users.Photo.get_user_photo(client, "user_id")
# {:ok, response}
Link to this section Summary
Functions
Creates a new %OAuth2.Client{}
struct configured for the Microsoft Graph API
with an Ueberauth config.
Creates a new %OAuth2.Client{}
struct configured for the Microsoft Graph API.
Default scope string helper.
Gets a token and puts the correct json header for the API.
Link to this section Functions
Link to this function
create(config)
Creates a new %OAuth2.Client{}
struct configured for the Microsoft Graph API
with an Ueberauth config.
example
Example:
iex> Microsoft.Client.create(Application.get_env(:ueberauth, Ueberauth.Strategy.Microsoft.OAuth))
%OAuth2.Client{}
Link to this function
create(client_id, client_secret, tenant_id)
Creates a new %OAuth2.Client{}
struct configured for the Microsoft Graph API.
examples
Examples:
iex> Microsoft.Client.create("client_id", "client_secret", "tenant_id")
%OAuth2.Client{}
Link to this function
default_scope()
Default scope string helper.
Link to this function
get_token!(client, params \\ [], headers \\ [], opts \\ [])
Gets a token and puts the correct json header for the API.
example
Example
# Returns a client with a valid access token
iex> MicrosoftGraph.Client.get_token!(%OAuth2.Client{})
%OAuth2.Client{}