All predicatesShow sourceauth_stackoverflow.pl -- Enable login with stackexchange

This module allows for configures _login with Stack exchange. To enable this module:

  1. Follow these steps to register your application on Stack Apps. Get the following info:
  2. COPY this file to config-enabled
  3. EDIT the server attributes
Source oauth2:server_attribute(?ServerID, ?Attribute, ?Value)[multifile]
Declare properties of an oauth2 identity provider. The values below are for StackExchange server.

EDIT:

See also
- swish(lib/oauth2) for a description of the attributes.
Source stackexchange_me(+AccessToken, -Info)[private]
Stack exchange does not support the oauth2 user_info endpoint. Instead, we must use the =/me= API. This is a little unlucky as we need to duplicate some infrastructure from the generic oauth2.pl module.
Source read_reply2(+Code, +ContentType, +Stream, -Dict) is det[private]
Read the server reply as a dict. Normally, the reply is a JSON object, but stackexchange seems to send it as a www-form-encoded string.
Source stackexchange_logout(+Request)[private]
Logout by removing the session data
Source swish_config:user_info(+Request, ?Server, -Info:dict) is semidet[multifile]
True if Info represents describes the currently logged in user.
Source map_user_info(+OAuthInfo, -UserInfo) is det[private]
u{user:User, group:Group, name:Name, email:Email}
Source uri_extend(+Base:atom, +Rel:atom, +Query:list, -URI:atom) is det[private]
Create a URI from Base, A relative URI and a query.
Source uri_extend_query(+URI0:atom, +Query:list, -URI:atom) is det[private]
Extend a URI with a query. If URI0 already has a query, keep all parameters that do not conflict.