Skip to navigation

JavaScript

Version 1.0 Released October 13, 2021

View on GitHub

This is JavaScript sample code to make API requests with IDMe using OAuth 2.0

You will need an IDMe developer account to complete this process

Prerequisites

1

You must include jquery and IDMe’s javascript dependencies in your application

2

You must have node installed

Dependencies

jQuery

<script type="text/javascript" src="https://code.jquery.com/jquery-3.7.1.min.js"></script>

IDMe

<script src="https://s3.amazonaws.com/idme/developer/idme-buttons-2.0.1/assets/js/idme-modal.min.js" type="text/javascript"></script>

Installation

1

Log in to your IDMe developer account and follow the prompts to use the button generator

2

Set your client configuration settings in idme.js with the values provided within your developer account

data-scope = 'SCOPE'
// possible scope values: "military", "student", "responder", "government", "teacher"
data-client-id = 'YOUR_CLIENT_ID'
data-redirect = `YOUR_REDIRECT_URI`
data-response = `RESPONSE`
// possible values: "code", "token"
data-op = `OP`
// possible values: "signin", "signup"
data-text = `OFFER_DESCRIPTION_TEXT`
data-display = 'DISPLAY'
// possible values: "popup", "link"
data-show-verify = 'SHOW'
// possible values: "true", "false"
3

Run the following within the directory of the sample code:

npm install -g serve
serve -p 3000
4

View the app at http://localhost:3000