Back-end implementation
Back-end implementation of the JS Connector consists of Xsteps as described below:
Implementing redirect_uri
when using method window
or inline
Since the JS Connector can open an iframe or a window for you, the handling of the post-authentication step is also important. This section will explain how you can take advantage of cross-domain messaging (XDM) to send the received code / tokens from the active window or iframe to the parent page (your site).
The redirect_uri
needs to handle the authorization response in order to receive authorization code and tokens on behalf of the user. This information is either delivered as part of the URL, or as a FORM POST if this response_mode
is specified.
Then, if you follow the callback page example for redirect_uri, you will see that special XDM calls are made to pass the information from the window/iframe to the listening JS Connector instance and finally to your callback - as the data retrived in the authentication response is sent to the callback provided with the BID.doConnect()
call.
With specific token_url and/or userinfo_url (experimental)
You can have the JS Connector call token_url
and userinfo_url
endpoints with the received data from the authentication response.
Token endpoint (token_url)
URL | As specified in configuration parameter token_endpoint | |
---|---|---|
Request mode | POST with parameters as application/x-www-form-urlencoded data | |
Request parameters | grant_type | Grant type is always authorization_code |
code | Value from response of the foregoing Authorize request | |
redirect_uri | Redirect URI used in the foregoing Authorize request | |
client_id | Not supported since the OIDC clients must always authenticate | |
OIDC Response /oauth/token | JSON { access_token: "654fe6f11ad61ceb1697d643b5fc59", token_type: "Bearer", expires_in: 3600, scope: "openid phone address", id_token: "...." // JWT } |
For documentation on the corresponding response to the OIDC platform, see Token
Userinfo endpoint (userinfo_url)
Using the access token (which also could be stored on the server) to access user information OIDC.
URL | As specified in configuration parameter userinfo_endpoint | |
---|---|---|
Request mode | POST with parameters as application/x-www-form-urlencoded data | |
Request parameters | access_token | Access token to be used as authorization to access OIDC IDP endpoint |
token_type | How access token shall be passed to OIDC OIDC endpoint ( | |
OIDC response /oauth/userinfo | JSON { |
For documentation on the corresponding response to the OIDC platform, see Userinfo