ID.me Button Widget
The following code snippet can be used to add the ID.me button widget to your app. This widget only supports a full page redirect to the authorization endpoint.
<span
id="idme-wallet-button"
data-scope="military,responder,student,teacher,government"
data-client-id="[YOUR_CLIENT_ID]"
data-redirect="[YOUR_REDIRECT_URI]"
data-response="code"
data-text="[AFFINITY GROUP] receives [OFFER] with ID.me"
data-show-verify="true">
</span>
<script src="https://s3.amazonaws.com/idme/developer/idme-buttons/assets/js/idme-wallet-button.js"></script>
Parameter | Values | Description | Required |
---|---|---|---|
data-scope |
military,responder,student,teacher,government
|
Defines the community you are requesting permission to access. | Required |
data-client-id |
[YOUR_CLIENT_ID]
|
The client identifier received during app registration. It is automatically generated and can be found in your application dashboard. | Required |
data-redirect |
[YOUR_REDIRECT_URI]
|
The url the user gets redirected to after authorizing an app. Set by the developer within the application dashboard. | Required |
data-response |
code
or
token
|
The OAuth 2.0 grant type - Authorization Code
(code )
or Implicit
(token ).
|
Required |
data-text |
Example:
Military members receive 10% off with ID.me
|
A recommended parameter that displays a custom offer description within the ID.me Button Widget. |
Required if
data-type="link"
|
data-logo |
[YOUR_LOGO_URL]
|
A recommended parameter that displays a logo at the community selection page. | Optional |
data-hero |
[YOUR_HERO_IMAGE_URL]
|
A recommended parameter that displays a hero image at the community selection page. | Optional |
data-state |
Example:
24730b6d
|
A parameter to carry through any server-specific state you need to protect against CSRF issues. | Optional |
data-display |
popup
or
fullpage
|
A recommended parameter that determines to user experience. Defaults to
fullpage .
|
Optional |
data-show-verify |
true
or
false
|
Displays the "Verification by ID.me" text. Defaults to
false .
|
Optional |
Example Pop-up Redirect Page
The user will authenticate, verify and then authorize your app inside of the popup before being taken to the redirect URI. Our suggestion as this point is to handle the OAuth token response, close the popup and then refresh the parent window. Here is an example of a dummy page you could place at the redirect URI to achieve this.
<!-- This code snippet is not production quality -->
<html>
<head>
<script type="text/javascript">
// Your application logic to handle the OAuth response
window.opener.location.reload();
window.close();
</script>
</head>
<body></body>
</html>